]> git.lizzy.rs Git - rust.git/commitdiff
rustc: remove Repr and UserString.
authorEduard Burtescu <edy.burt@gmail.com>
Thu, 18 Jun 2015 17:25:05 +0000 (20:25 +0300)
committerEduard Burtescu <edy.burt@gmail.com>
Thu, 18 Jun 2015 22:39:26 +0000 (01:39 +0300)
103 files changed:
src/librustc/middle/astconv_util.rs
src/librustc/middle/astencode.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 d955cda9b77b710f5a9f33084ea0047a6bba7f80..33d37b285890add380cb4af184013d386dba25db 100644 (file)
@@ -17,7 +17,6 @@
 use middle::def;
 use middle::ty::{self, Ty};
 use syntax::ast;
-use util::ppaux::Repr;
 
 pub const NO_REGIONS: usize = 1;
 pub const NO_TPS: usize = 2;
@@ -63,7 +62,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()))
+                                  &format!("unbound path {:?}", path))
             }
             Some(d) => d.full_def()
         };
index a6386d941f5fef9ed3da8463a3205ece6575fc0b..21e2ad198810efc4a62bfc0f76b538a52ec2a78b 100644 (file)
@@ -31,7 +31,6 @@
 use middle::subst;
 use middle::subst::VecPerParamSpace;
 use middle::ty::{self, Ty, MethodCall, MethodCallee, MethodOrigin};
-use util::ppaux::Repr;
 
 use syntax::{ast, ast_util, codemap, fold};
 use syntax::codemap::Span;
@@ -1623,8 +1622,8 @@ 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());
+                        debug!("inserting ty for node {}: {:?}",
+                               id,  ty);
                         dcx.tcx.node_type_insert(id, ty);
                     }
                     c::tag_table_item_subst => {
index 8982a45cee8f439969adbc3e1451857344d10738..e1f8e24253b39689fb3130126f3f4fd68a00224e 100644 (file)
@@ -36,7 +36,6 @@
 use syntax::parse::token;
 use syntax::ptr::P;
 use syntax::visit::{self, Visitor, FnKind};
-use util::ppaux::UserString;
 use util::nodemap::FnvHashMap;
 
 pub const DUMMY_WILD_PAT: &'static Pat = &Pat {
@@ -210,7 +209,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());
+                              pat_ty);
                 }
                 // If the type *is* empty, it's vacuously exhaustive
                 return;
@@ -243,11 +242,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());
+                                &token::get_ident(ident.node), pat_ty);
                             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(), &token::get_ident(ident.node));
+                                pat_ty, &token::get_ident(ident.node));
                         }
                     }
                 }
index a3881327b96ad2150b9b6242bf7993554d34bcd3..f5934751c58b282528c85fd6de0a76eb5aaeca3c 100644 (file)
@@ -15,7 +15,6 @@
 use middle::mem_categorization as mc;
 use middle::ty::ParameterEnvironment;
 use middle::ty;
-use util::ppaux::{Repr, UserString};
 
 use syntax::ast;
 use syntax::codemap::Span;
@@ -59,11 +58,11 @@ fn consume(&mut self,
                span: Span,
                cmt: mc::cmt<'tcx>,
                _: euv::ConsumeMode) {
-        debug!("consume; cmt: {:?}; type: {}", *cmt, cmt.ty.repr());
+        debug!("consume; cmt: {:?}; type: {:?}", *cmt, cmt.ty);
         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());
+                cmt.ty);
         }
     }
 
index 657115e781925b7250a15f640a1c2ececf57ad5c..23ad3f0d4b904357c32f8150cd3e54b27bf9eb8f 100644 (file)
@@ -23,7 +23,6 @@
 use middle::ty::{self, Ty};
 use middle::astconv_util::ast_ty_to_prim_ty;
 use util::num::ToPrimitive;
-use util::ppaux::Repr;
 
 use syntax::ast::{self, Expr};
 use syntax::ast_util;
@@ -1030,8 +1029,8 @@ fn resolve_trait_associated_const<'a, 'tcx: 'a>(tcx: &'a ty::ctxt<'tcx>,
                                                            rcvr_self,
                                                            Vec::new()));
     let trait_substs = tcx.mk_substs(trait_substs);
-    debug!("resolve_trait_associated_const: trait_substs={}",
-           trait_substs.repr());
+    debug!("resolve_trait_associated_const: trait_substs={:?}",
+           trait_substs);
     let trait_ref = ty::Binder(ty::TraitRef { def_id: trait_id,
                                               substs: trait_substs });
 
@@ -1052,10 +1051,10 @@ fn resolve_trait_associated_const<'a, 'tcx: 'a>(tcx: &'a ty::ctxt<'tcx>,
         }
         Err(e) => {
             tcx.sess.span_bug(ti.span,
-                              &format!("Encountered error `{}` when trying \
+                              &format!("Encountered error `{:?}` when trying \
                                         to select an implementation for \
                                         constant trait item reference.",
-                                       e.repr()))
+                                       e))
         }
     };
 
index 7a593da3432c944388d9dbfd3ee27844758ec12c..bb63ec42d8c0cb9c87473545e46ea77e8f5b6cdb 100644 (file)
@@ -15,7 +15,6 @@
 use middle::def;
 use middle::ty::{self, Ty};
 use middle::ty::MethodCall;
-use util::ppaux::Repr;
 
 use syntax::ast;
 use syntax::codemap::Span;
@@ -66,8 +65,8 @@ fn check_str_index(&mut self, e: &ast::Expr) {
             ast::ExprIndex(ref base, _) => ty::node_id_to_type(self.tcx, base.id),
             _ => return
         };
-        debug!("effect: checking index with base type {}",
-                 base_type.repr());
+        debug!("effect: checking index with base type {:?}",
+                 base_type);
         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,
@@ -142,8 +141,8 @@ fn visit_expr(&mut self, expr: &ast::Expr) {
             ast::ExprMethodCall(_, _, _) => {
                 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());
+                debug!("effect: method call case, base type is {:?}",
+                        base_type);
                 if type_is_unsafe_function(base_type) {
                     self.require_unsafe(expr.span,
                                         "invocation of unsafe method")
@@ -151,16 +150,16 @@ 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());
+                debug!("effect: call case, base type is {:?}",
+                        base_type);
                 if type_is_unsafe_function(base_type) {
                     self.require_unsafe(expr.span, "call to unsafe function")
                 }
             }
             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());
+                debug!("effect: unary case, base type is {:?}",
+                        base_type);
                 if let ty::TyRawPtr(_) = base_type.sty {
                     self.require_unsafe(expr.span, "dereference of raw pointer")
                 }
index 7d4f93fb1326f81e3023b9fc15c99e1df96ae209..ab67c68be124bd0938f31f5f5e52776acc99b481 100644 (file)
@@ -27,7 +27,6 @@
 use middle::ty::{MethodCall, MethodObject, MethodTraitObject};
 use middle::ty::{MethodOrigin, MethodParam, MethodTypeParam};
 use middle::ty::{MethodStatic, MethodStaticClosure};
-use util::ppaux::Repr;
 
 use syntax::{ast, ast_util};
 use syntax::ptr::P;
@@ -362,8 +361,8 @@ fn delegate_consume(&mut self,
                         consume_id: ast::NodeId,
                         consume_span: Span,
                         cmt: mc::cmt<'tcx>) {
-        debug!("delegate_consume(consume_id={}, cmt={})",
-               consume_id, cmt.repr());
+        debug!("delegate_consume(consume_id={}, cmt={:?})",
+               consume_id, cmt);
 
         let mode = copy_or_move(self.typer, &cmt, DirectRefMove);
         self.delegate.consume(consume_id, consume_span, cmt, mode);
@@ -376,7 +375,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());
+        debug!("consume_expr(expr={:?})", expr);
 
         let cmt = return_if_err!(self.mc.cat_expr(expr));
         self.delegate_consume(expr.id, expr.span, cmt);
@@ -397,8 +396,8 @@ fn borrow_expr(&mut self,
                    r: ty::Region,
                    bk: ty::BorrowKind,
                    cause: LoanCause) {
-        debug!("borrow_expr(expr={}, r={}, bk={})",
-               expr.repr(), r.repr(), bk.repr());
+        debug!("borrow_expr(expr={:?}, r={:?}, bk={:?})",
+               expr, r, bk);
 
         let cmt = return_if_err!(self.mc.cat_expr(expr));
         self.delegate.borrow(expr.id, expr.span, cmt, r, bk, cause);
@@ -414,7 +413,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());
+        debug!("walk_expr(expr={:?})", expr);
 
         self.walk_adjustment(expr);
 
@@ -618,8 +617,8 @@ 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(), callee_ty.repr());
+        debug!("walk_callee: callee={:?} callee_ty={:?}",
+               callee, callee_ty);
         let call_scope = region::CodeExtent::from_node_id(call.id);
         match callee_ty.sty {
             ty::TyBareFn(..) => {
@@ -637,7 +636,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()))
+                                &format!("unexpected callee type {}", callee_ty))
                         }
                     };
                 match overloaded_call_type {
@@ -811,7 +810,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(), autoderefs);
+        debug!("walk_autoderefs expr={:?} autoderefs={}", expr, autoderefs);
 
         for i in 0..autoderefs {
             let deref_id = ty::MethodCall::autoderef(expr.id, i as u32);
@@ -828,8 +827,8 @@ fn walk_autoderefs(&mut self,
                     let (m, r) = match self_ty.sty {
                         ty::TyRef(r, ref m) => (m.mutbl, r),
                         _ => self.tcx().sess.span_bug(expr.span,
-                                &format!("bad overloaded deref type {}",
-                                    method_ty.repr()))
+                                &format!("bad overloaded deref type {:?}",
+                                    method_ty))
                     };
                     let bk = ty::BorrowKind::from_mutbl(m);
                     self.delegate.borrow(expr.id, expr.span, cmt,
@@ -842,9 +841,9 @@ fn walk_autoderefs(&mut self,
     fn walk_autoderefref(&mut self,
                          expr: &ast::Expr,
                          adj: &ty::AutoDerefRef<'tcx>) {
-        debug!("walk_autoderefref expr={} adj={}",
-               expr.repr(),
-               adj.repr());
+        debug!("walk_autoderefref expr={:?} adj={:?}",
+               expr,
+               adj);
 
         self.walk_autoderefs(expr, adj.autoderefs);
 
@@ -875,9 +874,9 @@ fn walk_autoref(&mut self,
                     opt_autoref: Option<ty::AutoRef<'tcx>>)
                     -> mc::cmt<'tcx>
     {
-        debug!("walk_autoref(expr.id={} cmt_derefd={} opt_autoref={:?})",
+        debug!("walk_autoref(expr.id={} cmt_derefd={:?} opt_autoref={:?})",
                expr.id,
-               cmt_base.repr(),
+               cmt_base,
                opt_autoref);
 
         let cmt_base_ty = cmt_base.ty;
@@ -901,9 +900,9 @@ fn walk_autoref(&mut self,
             }
 
             ty::AutoUnsafe(m) => {
-                debug!("walk_autoref: expr.id={} cmt_base={}",
+                debug!("walk_autoref: expr.id={} cmt_base={:?}",
                        expr.id,
-                       cmt_base.repr());
+                       cmt_base);
 
                 // Converting from a &T to *T (or &mut T to *mut T) is
                 // treated as borrowing it for the enclosing temporary
@@ -1011,8 +1010,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(),
-               pat.repr());
+        debug!("determine_pat_move_mode cmt_discr={:?} pat={:?}", cmt_discr,
+               pat);
         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 +1042,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(),
-               pat.repr());
+        debug!("walk_pat cmt_discr={:?} pat={:?}", cmt_discr,
+               pat);
 
         let mc = &self.mc;
         let typer = self.typer;
@@ -1054,9 +1053,9 @@ fn walk_pat(&mut self,
             if pat_util::pat_is_binding(def_map, pat) {
                 let tcx = typer.tcx();
 
-                debug!("binding cmt_pat={} pat={} match_mode={:?}",
-                       cmt_pat.repr(),
-                       pat.repr(),
+                debug!("binding cmt_pat={:?} pat={:?} match_mode={:?}",
+                       cmt_pat,
+                       pat,
                        match_mode);
 
                 // pat_ty: the type of the binding being produced.
@@ -1160,9 +1159,9 @@ fn walk_pat(&mut self,
                                     mc.cat_downcast(pat, cmt_pat, cmt_pat_ty, variant_did)
                                 };
 
-                            debug!("variant downcast_cmt={} pat={}",
-                                   downcast_cmt.repr(),
-                                   pat.repr());
+                            debug!("variant downcast_cmt={:?} pat={:?}",
+                                   downcast_cmt,
+                                   pat);
 
                             delegate.matched_pat(pat, downcast_cmt, match_mode);
                         }
@@ -1172,9 +1171,9 @@ fn walk_pat(&mut self,
                             // namespace; we encounter the former on
                             // e.g. patterns for unit structs).
 
-                            debug!("struct cmt_pat={} pat={}",
-                                   cmt_pat.repr(),
-                                   pat.repr());
+                            debug!("struct cmt_pat={:?} pat={:?}",
+                                   cmt_pat,
+                                   pat);
 
                             delegate.matched_pat(pat, cmt_pat, match_mode);
                         }
@@ -1192,9 +1191,9 @@ fn walk_pat(&mut self,
                             // pattern.
 
                             if !tcx.sess.has_errors() {
-                                let msg = format!("Pattern has unexpected type: {:?} and type {}",
+                                let msg = format!("Pattern has unexpected type: {:?} and type {:?}",
                                                   def,
-                                                  cmt_pat.ty.repr());
+                                                  cmt_pat.ty);
                                 tcx.sess.span_bug(pat.span, &msg)
                             }
                         }
@@ -1209,9 +1208,9 @@ fn walk_pat(&mut self,
                             // reported.
 
                             if !tcx.sess.has_errors() {
-                                let msg = format!("Pattern has unexpected def: {:?} and type {}",
+                                let msg = format!("Pattern has unexpected def: {:?} and type {:?}",
                                                   def,
-                                                  cmt_pat.ty.repr());
+                                                  cmt_pat.ty);
                                 tcx.sess.span_bug(pat.span, &msg[..])
                             }
                         }
@@ -1237,7 +1236,7 @@ fn walk_pat(&mut self,
     }
 
     fn walk_captures(&mut self, closure_expr: &ast::Expr) {
-        debug!("walk_captures({})", closure_expr.repr());
+        debug!("walk_captures({:?})", closure_expr);
 
         ty::with_freevars(self.tcx(), closure_expr.id, |freevars| {
             for freevar in freevars {
index ed1ce3458a26b1c0cbc0a330fdd3bc8d6c297ccd..e08da94c7314a0b5c364c9181a44f8ecfaef604c 100644 (file)
@@ -14,7 +14,6 @@
 use middle::ty::{self, FreeRegion};
 use util::common::can_reach;
 use util::nodemap::FnvHashMap;
-use util::ppaux::Repr;
 
 #[derive(Clone)]
 pub struct FreeRegionMap {
@@ -32,7 +31,7 @@ pub fn relate_free_regions_from_implications<'tcx>(&mut self,
                                                        implications: &[Implication<'tcx>])
     {
         for implication in implications {
-            debug!("implication: {}", implication.repr());
+            debug!("implication: {:?}", implication);
             match *implication {
                 Implication::RegionSubRegion(_, ty::ReFree(free_a), ty::ReFree(free_b)) => {
                     self.relate_free_regions(free_a, free_b);
@@ -49,7 +48,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());
+        debug!("relate_free_regions_from_predicates(predicates={:?})", predicates);
         for predicate in predicates {
             match *predicate {
                 ty::Predicate::Projection(..) |
@@ -67,9 +66,9 @@ 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(),
-                                         r_b.repr()));
+                                &format!("record_region_bounds: non free region: {:?} / {:?}",
+                                         r_a,
+                                         r_b));
                         }
                     }
                 }
index abdaa9f38c0e1e06a5eee2ea2918d9c904d42444..d26df43286d9c8db04bc43834ca7e86485d31c25 100644 (file)
@@ -21,7 +21,6 @@
 
 use util::common::ErrorReported;
 use util::nodemap::FnvHashSet;
-use util::ppaux::Repr;
 
 // Helper functions related to manipulating region types.
 
@@ -54,10 +53,10 @@ pub fn implications<'a,'tcx>(
     span: Span)
     -> Vec<Implication<'tcx>>
 {
-    debug!("implications(body_id={}, ty={}, outer_region={})",
+    debug!("implications(body_id={}, ty={:?}, outer_region={:?})",
            body_id,
-           ty.repr(),
-           outer_region.repr());
+           ty,
+           outer_region);
 
     let mut stack = Vec::new();
     stack.push((outer_region, None));
@@ -69,7 +68,7 @@ pub fn implications<'a,'tcx>(
                               out: Vec::new(),
                               visited: FnvHashSet() };
     wf.accumulate_from_ty(ty);
-    debug!("implications: out={}", wf.out.repr());
+    debug!("implications: out={:?}", wf.out);
     wf.out
 }
 
@@ -79,8 +78,8 @@ fn tcx(&self) -> &'a ty::ctxt<'tcx> {
     }
 
     fn accumulate_from_ty(&mut self, ty: Ty<'tcx>) {
-        debug!("accumulate_from_ty(ty={})",
-               ty.repr());
+        debug!("accumulate_from_ty(ty={:?})",
+               ty);
 
         // When expanding out associated types, we can visit a cyclic
         // set of types. Issue #23003.
@@ -313,8 +312,8 @@ fn accumulate_from_adt(&mut self,
     fn accumulate_from_assoc_types_transitive(&mut self,
                                               data: &ty::PolyTraitPredicate<'tcx>)
     {
-        debug!("accumulate_from_assoc_types_transitive({})",
-               data.repr());
+        debug!("accumulate_from_assoc_types_transitive({:?})",
+               data);
 
         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,8 +326,8 @@ fn accumulate_from_assoc_types_transitive(&mut self,
     fn accumulate_from_assoc_types(&mut self,
                                    trait_ref: ty::TraitRef<'tcx>)
     {
-        debug!("accumulate_from_assoc_types({})",
-               trait_ref.repr());
+        debug!("accumulate_from_assoc_types({:?})",
+               trait_ref);
 
         let trait_def_id = trait_ref.def_id;
         let trait_def = ty::lookup_trait_def(self.tcx(), trait_def_id);
@@ -337,8 +336,8 @@ fn accumulate_from_assoc_types(&mut self,
                      .iter()
                      .map(|&name| ty::mk_projection(self.tcx(), trait_ref.clone(), name))
                      .collect();
-        debug!("accumulate_from_assoc_types: assoc_type_projections={}",
-               assoc_type_projections.repr());
+        debug!("accumulate_from_assoc_types: assoc_type_projections={:?}",
+               assoc_type_projections);
         let tys = match self.fully_normalize(&assoc_type_projections) {
             Ok(tys) => { tys }
             Err(ErrorReported) => { return; }
index 87eb08955117f0111c9491a4ecf10209c2afe14b..742ad3f29b7808aea72c87fba94d39eb94bdd7b3 100644 (file)
@@ -31,7 +31,6 @@
 use middle::ty::{self, Ty};
 use middle::ty::TyVar;
 use middle::ty_relate::{Relate, RelateResult, TypeRelation};
-use util::ppaux::{Repr};
 
 pub struct Bivariate<'a, 'tcx: 'a> {
     fields: CombineFields<'a, 'tcx>
@@ -73,8 +72,8 @@ 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(), b.repr());
+        debug!("{}.tys({:?}, {:?})", self.tag(),
+               a, b);
         if a == b { return Ok(a); }
 
         let infcx = self.fields.infcx;
index 30242dac695d960008aee4e4e2e946826e88d0ee..17d545212c281184c43f37b5b43b6670ed4f0197 100644 (file)
@@ -47,7 +47,6 @@
 use middle::ty_fold;
 use middle::ty_fold::{TypeFolder, TypeFoldable};
 use middle::ty_relate::{self, Relate, RelateResult, TypeRelation};
-use util::ppaux::Repr;
 
 use syntax::ast;
 use syntax::codemap::Span;
@@ -212,10 +211,10 @@ pub fn instantiate(&self,
                 Some(e) => e,
             };
 
-            debug!("instantiate(a_ty={} dir={:?} b_vid={})",
-                   a_ty.repr(),
+            debug!("instantiate(a_ty={:?} dir={:?} b_vid={:?})",
+                   a_ty,
                    dir,
-                   b_vid.repr());
+                   b_vid);
 
             // Check whether `vid` has been instantiated yet.  If not,
             // make a generalized form of `ty` and instantiate with
@@ -229,10 +228,10 @@ pub fn instantiate(&self,
                         EqTo => self.generalize(a_ty, b_vid, false),
                         BiTo | SupertypeOf | SubtypeOf => self.generalize(a_ty, b_vid, true),
                     });
-                    debug!("instantiate(a_ty={}, dir={:?}, \
-                                        b_vid={}, generalized_ty={})",
-                           a_ty.repr(), dir, b_vid.repr(),
-                           generalized_ty.repr());
+                    debug!("instantiate(a_ty={:?}, dir={:?}, \
+                                        b_vid={:?}, generalized_ty={:?})",
+                           a_ty, dir, b_vid,
+                           generalized_ty);
                     self.infcx.type_variables
                         .borrow_mut()
                         .instantiate_and_push(
@@ -334,8 +333,8 @@ fn fold_region(&mut self, r: ty::Region) -> ty::Region {
             ty::ReEarlyBound(..) => {
                 self.tcx().sess.span_bug(
                     self.span,
-                    &format!("Encountered early bound region when generalizing: {}",
-                            r.repr()));
+                    &format!("Encountered early bound region when generalizing: {:?}",
+                            r));
             }
 
             // Always make a fresh region variable for skolemized regions;
index 0d97535ed3abeb834ce687db3d7823d8e7822fff..cbbf73d942073c2714bf30bcc84f169526a2f4ce 100644 (file)
@@ -16,7 +16,6 @@
 use middle::ty::{self, Ty};
 use middle::ty::TyVar;
 use middle::ty_relate::{Relate, RelateResult, TypeRelation};
-use util::ppaux::{Repr};
 
 pub struct Equate<'a, 'tcx: 'a> {
     fields: CombineFields<'a, 'tcx>
@@ -45,8 +44,8 @@ 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(), b.repr());
+        debug!("{}.tys({:?}, {:?})", self.tag(),
+               a, b);
         if a == b { return Ok(a); }
 
         let infcx = self.fields.infcx;
@@ -75,10 +74,10 @@ 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({}, {})",
+        debug!("{}.regions({:?}, {:?})",
                self.tag(),
-               a.repr(),
-               b.repr());
+               a,
+               b);
         let origin = Subtype(self.fields.trace.clone());
         self.fields.infcx.region_vars.make_eqregion(origin, a, b);
         Ok(a)
index 9f3dd0a4b736bf8cf881812d45ad7076321d031a..4ae618d45b7280b644059a1f2d06ed7745dc6a33 100644 (file)
 use middle::subst;
 use middle::ty::{self, Ty};
 use middle::ty::{Region, ReFree};
+
 use std::cell::{Cell, RefCell};
 use std::char::from_u32;
-use std::string::String;
+use std::fmt;
 use syntax::ast;
 use syntax::ast_util::name_to_dummy_lifetime;
 use syntax::owned_slice::OwnedSlice;
 use syntax::print::pprust;
 use syntax::ptr::P;
 
-// Note: only import UserString, not Repr, since user-facing error
-// messages shouldn't include debug serializations.
-use util::ppaux::UserString;
-
 pub fn note_and_explain_region(tcx: &ty::ctxt,
                                prefix: &str,
                                region: ty::Region,
@@ -170,7 +167,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())
+                            fr.bound_region)
                 }
             };
 
@@ -229,7 +226,7 @@ fn report_and_explain_type_error(&self,
 
     fn values_str(&self, values: &ValuePairs<'tcx>) -> Option<String>;
 
-    fn expected_found_str<T: UserString + Resolvable<'tcx>>(
+    fn expected_found_str<T: fmt::Display + Resolvable<'tcx>>(
         &self,
         exp_found: &ty::expected_found<T>)
         -> Option<String>;
@@ -507,7 +504,7 @@ fn values_str(&self, values: &ValuePairs<'tcx>) -> Option<String> {
         }
     }
 
-    fn expected_found_str<T: UserString + Resolvable<'tcx>>(
+    fn expected_found_str<T: fmt::Display + Resolvable<'tcx>>(
         &self,
         exp_found: &ty::expected_found<T>)
         -> Option<String>
@@ -523,8 +520,8 @@ fn expected_found_str<T: UserString + Resolvable<'tcx>>(
         }
 
         Some(format!("expected `{}`, found `{}`",
-                     expected.user_string(),
-                     found.user_string()))
+                     expected,
+                     found))
     }
 
     fn report_generic_bound_failure(&self,
@@ -540,9 +537,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()),
+                format!("the parameter type `{}`", p),
             GenericKind::Projection(ref p) =>
-                format!("the associated type `{}`", p.user_string()),
+                format!("the associated type `{}`", p),
         };
 
         match sub {
@@ -554,8 +551,8 @@ fn report_generic_bound_failure(&self,
                     origin.span(),
                     &format!(
                         "consider adding an explicit lifetime bound `{}: {}`...",
-                        bound_kind.user_string(),
-                        sub.user_string()));
+                        bound_kind,
+                        sub));
             }
 
             ty::ReStatic => {
@@ -566,7 +563,7 @@ fn report_generic_bound_failure(&self,
                     origin.span(),
                     &format!(
                         "consider adding an explicit lifetime bound `{}: 'static`...",
-                        bound_kind.user_string()));
+                        bound_kind));
             }
 
             _ => {
@@ -578,7 +575,7 @@ fn report_generic_bound_failure(&self,
                     origin.span(),
                     &format!(
                         "consider adding an explicit lifetime bound for `{}`",
-                        bound_kind.user_string()));
+                        bound_kind));
                 note_and_explain_region(
                     self.tcx,
                     &format!("{} must be valid for ", labeled_user_string),
@@ -1561,7 +1558,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();
+            let mut s = br.to_string();
             if !s.is_empty() {
                 s.push_str(" ");
             }
index b611565c151ca0deb668de24210b833947292539..d6b03266b1fe74e32d4d58cc2d2f5ef0cb316bb3 100644 (file)
@@ -16,7 +16,6 @@
 
 use middle::ty::{self, Ty};
 use middle::ty_relate::{Relate, RelateResult, TypeRelation};
-use util::ppaux::Repr;
 
 /// "Greatest lower bound" (common subtype)
 pub struct Glb<'a, 'tcx: 'a> {
@@ -55,10 +54,10 @@ 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({}, {})",
+        debug!("{}.regions({:?}, {:?})",
                self.tag(),
-               a.repr(),
-               b.repr());
+               a,
+               b);
 
         let origin = Subtype(self.fields.trace.clone());
         Ok(self.fields.infcx.region_vars.glb_regions(origin, a, b))
index 37f3a12b05f6124ca43b35c6c8d3c39187ae82e3..7b26f6b153733a7f13e8125ead80914a9a48c08c 100644 (file)
@@ -20,7 +20,6 @@
 use middle::ty_relate::{Relate, RelateResult, TypeRelation};
 use syntax::codemap::Span;
 use util::nodemap::{FnvHashMap, FnvHashSet};
-use util::ppaux::Repr;
 
 pub trait HigherRankedRelations<'a,'tcx> {
     fn higher_ranked_sub<T>(&self, a: &Binder<T>, b: &Binder<T>) -> RelateResult<'tcx, Binder<T>>
@@ -46,8 +45,8 @@ fn higher_ranked_sub<T>(&self, a: &Binder<T>, b: &Binder<T>)
                             -> RelateResult<'tcx, Binder<T>>
         where T: Relate<'a,'tcx>
     {
-        debug!("higher_ranked_sub(a={}, b={})",
-               a.repr(), b.repr());
+        debug!("higher_ranked_sub(a={:?}, b={:?})",
+               a, b);
 
         // 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
@@ -73,8 +72,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());
-            debug!("b_prime={}", b_prime.repr());
+            debug!("a_prime={:?}", a_prime);
+            debug!("b_prime={:?}", b_prime);
 
             // Compare types now that bound regions have been replaced.
             let result = try!(self.sub().relate(&a_prime, &b_prime));
@@ -96,8 +95,8 @@ fn higher_ranked_sub<T>(&self, a: &Binder<T>, b: &Binder<T>)
                 }
             }
 
-            debug!("higher_ranked_sub: OK result={}",
-                   result.repr());
+            debug!("higher_ranked_sub: OK result={:?}",
+                   result);
 
             Ok(ty::Binder(result))
         });
@@ -123,7 +122,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());
+            debug!("lub result0 = {:?}", result0);
 
             // Generalize the regions appearing in result0 if possible
             let new_vars = self.infcx.region_vars_confined_to_snapshot(snapshot);
@@ -135,10 +134,10 @@ fn higher_ranked_lub<T>(&self, a: &Binder<T>, b: &Binder<T>) -> RelateResult<'tc
                     |r, debruijn| generalize_region(self.infcx, span, snapshot, debruijn,
                                                     &new_vars, &a_map, r));
 
-            debug!("lub({},{}) = {}",
-                   a.repr(),
-                   b.repr(),
-                   result1.repr());
+            debug!("lub({:?},{:?}) = {:?}",
+                   a,
+                   b,
+                   result1);
 
             Ok(ty::Binder(result1))
         });
@@ -196,8 +195,8 @@ fn generalize_region(infcx: &InferCtxt,
     fn higher_ranked_glb<T>(&self, a: &Binder<T>, b: &Binder<T>) -> RelateResult<'tcx, Binder<T>>
         where T: Relate<'a,'tcx>
     {
-        debug!("higher_ranked_glb({}, {})",
-               a.repr(), b.repr());
+        debug!("higher_ranked_glb({:?}, {:?})",
+               a, b);
 
         // Make a snapshot so we can examine "all bindings that were
         // created as part of this type comparison".
@@ -217,7 +216,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());
+            debug!("glb result0 = {:?}", result0);
 
             // Generalize the regions appearing in result0 if possible
             let new_vars = self.infcx.region_vars_confined_to_snapshot(snapshot);
@@ -231,10 +230,10 @@ fn higher_ranked_glb<T>(&self, a: &Binder<T>, b: &Binder<T>) -> RelateResult<'tc
                                                     &a_map, &a_vars, &b_vars,
                                                     r));
 
-            debug!("glb({},{}) = {}",
-                   a.repr(),
-                   b.repr(),
-                   result1.repr());
+            debug!("glb({:?},{:?}) = {:?}",
+                   a,
+                   b,
+                   result1);
 
             Ok(ty::Binder(result1))
         });
@@ -449,9 +448,9 @@ fn region_vars_confined_to_snapshot(&self,
             !escaping_region_vars.contains(&r)
         });
 
-        debug!("region_vars_confined_to_snapshot: region_vars={} escaping_types={}",
-               region_vars.repr(),
-               escaping_types.repr());
+        debug!("region_vars_confined_to_snapshot: region_vars={:?} escaping_types={:?}",
+               region_vars,
+               escaping_types);
 
         region_vars
     }
@@ -532,10 +531,10 @@ pub fn skolemize_late_bound_regions<'a,'tcx,T>(infcx: &InferCtxt<'a,'tcx>,
         infcx.region_vars.new_skolemized(br, &snapshot.region_vars_snapshot)
     });
 
-    debug!("skolemize_bound_regions(binder={}, result={}, map={})",
-           binder.repr(),
-           result.repr(),
-           map.repr());
+    debug!("skolemize_bound_regions(binder={:?}, result={:?}, map={:?})",
+           binder,
+           result,
+           map);
 
     (result, map)
 }
@@ -553,8 +552,8 @@ pub fn leak_check<'a,'tcx>(infcx: &InferCtxt<'a,'tcx>,
      * hold. See `README.md` for more details.
      */
 
-    debug!("leak_check: skol_map={}",
-           skol_map.repr());
+    debug!("leak_check: skol_map={:?}",
+           skol_map);
 
     let new_vars = infcx.region_vars_confined_to_snapshot(snapshot);
     for (&skol_br, &skol) in skol_map {
@@ -571,10 +570,10 @@ pub fn leak_check<'a,'tcx>(infcx: &InferCtxt<'a,'tcx>,
                 }
             };
 
-            debug!("{} (which replaced {}) is tainted by {}",
-                   skol.repr(),
-                   skol_br.repr(),
-                   tainted_region.repr());
+            debug!("{:?} (which replaced {:?}) is tainted by {:?}",
+                   skol,
+                   skol_br,
+                   tainted_region);
 
             // A is not as polymorphic as B:
             return Err((skol_br, tainted_region));
@@ -620,9 +619,9 @@ pub fn plug_leaks<'a,'tcx,T>(infcx: &InferCtxt<'a,'tcx>,
 {
     debug_assert!(leak_check(infcx, &skol_map, snapshot).is_ok());
 
-    debug!("plug_leaks(skol_map={}, value={})",
-           skol_map.repr(),
-           value.repr());
+    debug!("plug_leaks(skol_map={:?}, value={:?})",
+           skol_map,
+           value);
 
     // Compute a mapping from the "taint set" of each skolemized
     // region back to the `ty::BoundRegion` that it originally
@@ -638,8 +637,8 @@ pub fn plug_leaks<'a,'tcx,T>(infcx: &InferCtxt<'a,'tcx>,
         })
         .collect();
 
-    debug!("plug_leaks: inv_skol_map={}",
-           inv_skol_map.repr());
+    debug!("plug_leaks: inv_skol_map={:?}",
+           inv_skol_map);
 
     // Remove any instantiated type variables from `value`; those can hide
     // references to regions from the `fold_regions` code below.
@@ -667,8 +666,8 @@ pub fn plug_leaks<'a,'tcx,T>(infcx: &InferCtxt<'a,'tcx>,
         }
     });
 
-    debug!("plug_leaks: result={}",
-           result.repr());
+    debug!("plug_leaks: result={:?}",
+           result);
 
     result
 }
index 6257b6e6a257964337ecf4bebb256dacfe7382e0..7b34fda24064ef7fff78846eae32b6dc220b7230 100644 (file)
@@ -35,7 +35,6 @@
 use middle::ty::TyVar;
 use middle::ty::{self, Ty};
 use middle::ty_relate::{RelateResult, TypeRelation};
-use util::ppaux::Repr;
 
 pub trait LatticeDir<'f,'tcx> : TypeRelation<'f,'tcx> {
     fn infcx(&self) -> &'f InferCtxt<'f, 'tcx>;
@@ -51,10 +50,10 @@ pub fn super_lattice_tys<'a,'tcx,L:LatticeDir<'a,'tcx>>(this: &mut L,
                                                         -> RelateResult<'tcx, Ty<'tcx>>
     where 'tcx: 'a
 {
-    debug!("{}.lattice_tys({}, {})",
+    debug!("{}.lattice_tys({:?}, {:?})",
            this.tag(),
-           a.repr(),
-           b.repr());
+           a,
+           b);
 
     if a == b {
         return Ok(a);
index f4ba639547bf1cfc8df723ccc14ad94c459f682d..9d993ead5ca20039e78c396c394866d7ec0fc416 100644 (file)
@@ -16,7 +16,6 @@
 
 use middle::ty::{self, Ty};
 use middle::ty_relate::{Relate, RelateResult, TypeRelation};
-use util::ppaux::Repr;
 
 /// "Least upper bound" (common supertype)
 pub struct Lub<'a, 'tcx: 'a> {
@@ -55,10 +54,10 @@ 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({}, {})",
+        debug!("{}.regions({:?}, {:?})",
                self.tag(),
-               a.repr(),
-               b.repr());
+               a,
+               b);
 
         let origin = Subtype(self.fields.trace.clone());
         Ok(self.fields.infcx.region_vars.lub_regions(origin, a, b))
index 71febd981e045eaa72c9be0f41cda10974989dbb..2df335b5c3c0a89dd1ab7df0ab9f2476fb00aac4 100644 (file)
@@ -36,7 +36,6 @@
 use syntax::codemap;
 use syntax::codemap::Span;
 use util::nodemap::FnvHashMap;
-use util::ppaux::{Repr, UserString};
 
 use self::combine::CombineFields;
 use self::region_inference::{RegionVarBindings, RegionSnapshot};
@@ -330,8 +329,8 @@ pub fn common_supertype<'a, 'tcx>(cx: &InferCtxt<'a, 'tcx>,
                                   b: Ty<'tcx>)
                                   -> Ty<'tcx>
 {
-    debug!("common_supertype({}, {})",
-           a.repr(), b.repr());
+    debug!("common_supertype({:?}, {:?})",
+           a, b);
 
     let trace = TypeTrace {
         origin: origin,
@@ -355,7 +354,7 @@ pub fn mk_subty<'a, 'tcx>(cx: &InferCtxt<'a, 'tcx>,
                           b: Ty<'tcx>)
                           -> UnitResult<'tcx>
 {
-    debug!("mk_subty({} <: {})", a.repr(), b.repr());
+    debug!("mk_subty({:?} <: {:?})", a, b);
     cx.sub_types(a_is_expected, origin, a, b)
 }
 
@@ -363,7 +362,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(), b.repr());
+    debug!("can_mk_subty({:?} <: {:?})", a, b);
     cx.probe(|_| {
         let trace = TypeTrace {
             origin: Misc(codemap::DUMMY_SP),
@@ -383,7 +382,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(), b.repr());
+    debug!("mk_subr({:?} <: {:?})", a, b);
     let snapshot = cx.region_vars.start_snapshot();
     cx.region_vars.make_subregion(origin, a, b);
     cx.region_vars.commit(snapshot);
@@ -396,7 +395,7 @@ pub fn mk_eqty<'a, 'tcx>(cx: &InferCtxt<'a, 'tcx>,
                          b: Ty<'tcx>)
                          -> UnitResult<'tcx>
 {
-    debug!("mk_eqty({} <: {})", a.repr(), b.repr());
+    debug!("mk_eqty({:?} <: {:?})", a, b);
     cx.commit_if_ok(|_| cx.eq_types(a_is_expected, origin, a, b))
 }
 
@@ -407,8 +406,8 @@ pub fn mk_sub_poly_trait_refs<'a, 'tcx>(cx: &InferCtxt<'a, 'tcx>,
                                    b: ty::PolyTraitRef<'tcx>)
                                    -> UnitResult<'tcx>
 {
-    debug!("mk_sub_trait_refs({} <: {})",
-           a.repr(), b.repr());
+    debug!("mk_sub_trait_refs({:?} <: {:?})",
+           a, b);
     cx.commit_if_ok(|_| cx.sub_poly_trait_refs(a_is_expected, origin, a.clone(), b.clone()))
 }
 
@@ -637,7 +636,7 @@ pub fn sub_types(&self,
                      b: Ty<'tcx>)
                      -> UnitResult<'tcx>
     {
-        debug!("sub_types({} <: {})", a.repr(), b.repr());
+        debug!("sub_types({:?} <: {:?})", a, b);
         self.commit_if_ok(|_| {
             let trace = TypeTrace::types(origin, a_is_expected, a, b);
             self.sub(a_is_expected, trace).relate(&a, &b).map(|_| ())
@@ -664,9 +663,9 @@ pub fn sub_trait_refs(&self,
                           b: ty::TraitRef<'tcx>)
                           -> UnitResult<'tcx>
     {
-        debug!("sub_trait_refs({} <: {})",
-               a.repr(),
-               b.repr());
+        debug!("sub_trait_refs({:?} <: {:?})",
+               a,
+               b);
         self.commit_if_ok(|_| {
             let trace = TypeTrace {
                 origin: origin,
@@ -683,9 +682,9 @@ pub fn sub_poly_trait_refs(&self,
                                b: ty::PolyTraitRef<'tcx>)
                                -> UnitResult<'tcx>
     {
-        debug!("sub_poly_trait_refs({} <: {})",
-               a.repr(),
-               b.repr());
+        debug!("sub_poly_trait_refs({:?} <: {:?})",
+               a,
+               b);
         self.commit_if_ok(|_| {
             let trace = TypeTrace {
                 origin: origin,
@@ -861,7 +860,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.resolve_type_vars_if_possible(&t).to_string()
     }
 
     pub fn tys_to_string(&self, ts: &[Ty<'tcx>]) -> String {
@@ -870,8 +869,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.resolve_type_vars_if_possible(t).to_string()
     }
 
     pub fn shallow_resolve(&self, typ: Ty<'tcx>) -> Ty<'tcx> {
@@ -1047,18 +1045,18 @@ pub fn verify_generic_bound(&self,
                                 kind: GenericKind<'tcx>,
                                 a: ty::Region,
                                 bs: Vec<ty::Region>) {
-        debug!("verify_generic_bound({}, {} <: {})",
-               kind.repr(),
-               a.repr(),
-               bs.repr());
+        debug!("verify_generic_bound({:?}, {:?} <: {:?})",
+               kind,
+               a,
+               bs);
 
         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
+        where T: Relate<'b,'tcx> + fmt::Debug
     {
-        debug!("can_equate({}, {})", a.repr(), b.repr());
+        debug!("can_equate({:?}, {:?})", a, b);
         self.probe(|_| {
             // Gin up a dummy trace, since this won't be committed
             // anyhow. We should make this typetrace stuff more
index be606e6fa4afd072ef17d14b387e50261c6844e2..869f4d011cefe18218eb3752c41f029e3cfdafc3 100644 (file)
@@ -24,7 +24,6 @@
 use middle::infer::SubregionOrigin;
 use middle::infer::region_inference::RegionVarBindings;
 use util::nodemap::{FnvHashMap, FnvHashSet};
-use util::ppaux::Repr;
 
 use std::borrow::Cow;
 use std::collections::hash_map::Entry::Vacant;
@@ -191,13 +190,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())),
+                dot::LabelText::label(format!("{:?}", n_rgn)),
         }
     }
     fn edge_label(&self, e: &Edge) -> dot::LabelText {
         match *e {
             Edge::Constraint(ref c) =>
-                dot::LabelText::label(format!("{}", self.map.get(c).unwrap().repr())),
+                dot::LabelText::label(format!("{:?}", self.map.get(c).unwrap())),
             Edge::EnclScope(..) =>
                 dot::LabelText::label(format!("(enclosed)")),
         }
index 024889d08290b9bc6a29b2f0488801355d1d12c0..ddd352fcb430aaefbb0098266e6eadf2665e2e1b 100644 (file)
@@ -30,7 +30,6 @@
 use middle::ty_relate::RelateResult;
 use util::common::indenter;
 use util::nodemap::{FnvHashMap, FnvHashSet};
-use util::ppaux::Repr;
 
 use std::cell::{Cell, RefCell};
 use std::cmp::Ordering::{self, Less, Greater, Equal};
@@ -324,8 +323,8 @@ pub fn new_region_var(&self, origin: RegionVariableOrigin) -> RegionVid {
         if self.in_snapshot() {
             self.undo_log.borrow_mut().push(AddVar(vid));
         }
-        debug!("created new region variable {:?} with origin {}",
-               vid, origin.repr());
+        debug!("created new region variable {:?} with origin {:?}",
+               vid, origin);
         return vid;
     }
 
@@ -392,8 +391,8 @@ fn add_constraint(&self,
         // cannot add constraints once regions are resolved
         assert!(self.values_are_none());
 
-        debug!("RegionVarBindings: add_constraint({})",
-               constraint.repr());
+        debug!("RegionVarBindings: add_constraint({:?})",
+               constraint);
 
         if self.constraints.borrow_mut().insert(constraint, origin).is_none() {
             if self.in_snapshot() {
@@ -407,8 +406,8 @@ fn add_verify(&self,
         // cannot add verifys once regions are resolved
         assert!(self.values_are_none());
 
-        debug!("RegionVarBindings: add_verify({})",
-               verify.repr());
+        debug!("RegionVarBindings: add_verify({:?})",
+               verify);
 
         let mut verifys = self.verifys.borrow_mut();
         let index = verifys.len();
@@ -426,8 +425,8 @@ pub fn add_given(&self,
 
         let mut givens = self.givens.borrow_mut();
         if givens.insert((sub, sup)) {
-            debug!("add_given({} <= {:?})",
-                   sub.repr(),
+            debug!("add_given({:?} <= {:?})",
+                   sub,
                    sup);
 
             self.undo_log.borrow_mut().push(AddGiven(sub, sup));
@@ -453,10 +452,10 @@ pub fn make_subregion(&self,
         // cannot add constraints once regions are resolved
         assert!(self.values_are_none());
 
-        debug!("RegionVarBindings: make_subregion({}, {}) due to {}",
-               sub.repr(),
-               sup.repr(),
-               origin.repr());
+        debug!("RegionVarBindings: make_subregion({:?}, {:?}) due to {:?}",
+               sub,
+               sup,
+               origin);
 
         match (sub, sup) {
           (ReEarlyBound(..), ReEarlyBound(..)) => {
@@ -472,9 +471,9 @@ pub fn make_subregion(&self,
           (_, ReLateBound(..)) => {
             self.tcx.sess.span_bug(
                 origin.span(),
-                &format!("cannot relate bound region: {} <= {}",
-                        sub.repr(),
-                        sup.repr()));
+                &format!("cannot relate bound region: {:?} <= {:?}",
+                        sub,
+                        sup));
           }
           (_, ReStatic) => {
             // all regions are subregions of static, so we can ignore this
@@ -511,9 +510,9 @@ pub fn lub_regions(&self,
         // cannot add constraints once regions are resolved
         assert!(self.values_are_none());
 
-        debug!("RegionVarBindings: lub_regions({}, {})",
-               a.repr(),
-               b.repr());
+        debug!("RegionVarBindings: lub_regions({:?}, {:?})",
+               a,
+               b);
         match (a, b) {
             (ReStatic, _) | (_, ReStatic) => {
                 ReStatic // nothing lives longer than static
@@ -536,9 +535,9 @@ pub fn glb_regions(&self,
         // cannot add constraints once regions are resolved
         assert!(self.values_are_none());
 
-        debug!("RegionVarBindings: glb_regions({}, {})",
-               a.repr(),
-               b.repr());
+        debug!("RegionVarBindings: glb_regions({:?}, {:?})",
+               a,
+               b);
         match (a, b) {
             (ReStatic, r) | (r, ReStatic) => {
                 // static lives longer than everything else
@@ -564,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());
+                debug!("resolve_var({:?}) = {:?}", rid, r);
                 r
             }
         }
@@ -621,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());
+        debug!("tainted(mark={:?}, r0={:?})", mark, r0);
         let _indenter = indenter();
 
         // `result_set` acts as a worklist: we explore all outgoing
@@ -732,9 +731,9 @@ fn lub_concrete_regions(&self, free_regions: &FreeRegionMap, a: Region, b: Regio
           (ReEarlyBound(..), _) |
           (_, ReEarlyBound(..)) => {
             self.tcx.sess.bug(
-                &format!("cannot relate bound region: LUB({}, {})",
-                        a.repr(),
-                        b.repr()));
+                &format!("cannot relate bound region: LUB({:?}, {:?})",
+                        a,
+                        b));
           }
 
           (ReStatic, _) | (_, ReStatic) => {
@@ -837,9 +836,9 @@ fn glb_concrete_regions(&self,
             (ReEarlyBound(..), _) |
             (_, ReEarlyBound(..)) => {
               self.tcx.sess.bug(
-                  &format!("cannot relate bound region: GLB({}, {})",
-                          a.repr(),
-                          b.repr()));
+                  &format!("cannot relate bound region: GLB({:?}, {:?})",
+                          a,
+                          b));
             }
 
             (ReStatic, r) | (r, ReStatic) => {
@@ -1014,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());
+            debug!("Constraint {} => {:?}", idx, constraint);
         }
     }
 
     fn expansion(&self, free_regions: &FreeRegionMap, var_data: &mut [VarData]) {
         self.iterate_until_fixed_point("Expansion", |constraint| {
-            debug!("expansion: constraint={} origin={}",
-                   constraint.repr(),
+            debug!("expansion: constraint={:?} origin={:?}",
+                   constraint,
                    self.constraints.borrow()
                                    .get(constraint)
                                    .unwrap()
-                                   .repr());
+                                   );
             match *constraint {
               ConstrainRegSubVar(a_region, b_vid) => {
                 let b_data = &mut var_data[b_vid.index as usize];
@@ -1055,10 +1054,10 @@ fn expand_node(&self,
                    b_data: &mut VarData)
                    -> bool
     {
-        debug!("expand_node({}, {:?} == {})",
-               a_region.repr(),
+        debug!("expand_node({:?}, {:?} == {:?})",
+               a_region,
                b_vid,
-               b_data.value.repr());
+               b_data.value);
 
         // Check if this relationship is implied by a given.
         match a_region {
@@ -1074,8 +1073,8 @@ fn expand_node(&self,
         b_data.classification = Expanding;
         match b_data.value {
           NoValue => {
-            debug!("Setting initial value of {:?} to {}",
-                   b_vid, a_region.repr());
+            debug!("Setting initial value of {:?} to {:?}",
+                   b_vid, a_region);
 
             b_data.value = Value(a_region);
             return true;
@@ -1087,10 +1086,10 @@ fn expand_node(&self,
                 return false;
             }
 
-            debug!("Expanding value of {:?} from {} to {}",
+            debug!("Expanding value of {:?} from {:?} to {:?}",
                    b_vid,
-                   cur_region.repr(),
-                   lub.repr());
+                   cur_region,
+                   lub);
 
             b_data.value = Value(lub);
             return true;
@@ -1106,12 +1105,12 @@ fn contraction(&self,
                    free_regions: &FreeRegionMap,
                    var_data: &mut [VarData]) {
         self.iterate_until_fixed_point("Contraction", |constraint| {
-            debug!("contraction: constraint={} origin={}",
-                   constraint.repr(),
+            debug!("contraction: constraint={:?} origin={:?}",
+                   constraint,
                    self.constraints.borrow()
                                    .get(constraint)
                                    .unwrap()
-                                   .repr());
+                                   );
             match *constraint {
               ConstrainRegSubVar(..) => {
                 // This is an expansion constraint.  Ignore.
@@ -1140,9 +1139,9 @@ fn contract_node(&self,
                      a_data: &mut VarData,
                      b_region: Region)
                      -> bool {
-        debug!("contract_node({:?} == {}/{:?}, {})",
-               a_vid, a_data.value.repr(),
-               a_data.classification, b_region.repr());
+        debug!("contract_node({:?} == {:?}/{:?}, {:?})",
+               a_vid, a_data.value,
+               a_data.classification, b_region);
 
         return match a_data.value {
             NoValue => {
@@ -1172,10 +1171,10 @@ fn check_node(this: &RegionVarBindings,
                       -> bool
         {
             if !free_regions.is_subregion_of(this.tcx, a_region, b_region) {
-                debug!("Setting {:?} to ErrorValue: {} not subregion of {}",
+                debug!("Setting {:?} to ErrorValue: {:?} not subregion of {:?}",
                        a_vid,
-                       a_region.repr(),
-                       b_region.repr());
+                       a_region,
+                       b_region);
                 a_data.value = ErrorValue;
             }
             false
@@ -1193,19 +1192,19 @@ fn adjust_node(this: &RegionVarBindings,
                     if glb == a_region {
                         false
                     } else {
-                        debug!("Contracting value of {:?} from {} to {}",
+                        debug!("Contracting value of {:?} from {:?} to {:?}",
                                a_vid,
-                               a_region.repr(),
-                               glb.repr());
+                               a_region,
+                               glb);
                         a_data.value = Value(glb);
                         true
                     }
                 }
                 Err(_) => {
-                    debug!("Setting {:?} to ErrorValue: no glb of {}, {}",
+                    debug!("Setting {:?} to ErrorValue: no glb of {:?}, {:?}",
                            a_vid,
-                           a_region.repr(),
-                           b_region.repr());
+                           a_region,
+                           b_region);
                     a_data.value = ErrorValue;
                     false
                 }
@@ -1230,9 +1229,9 @@ fn collect_concrete_region_errors(&self,
                         continue;
                     }
 
-                    debug!("ConcreteFailure: !(sub <= sup): sub={}, sup={}",
-                           sub.repr(),
-                           sup.repr());
+                    debug!("ConcreteFailure: !(sub <= sup): sub={:?}, sup={:?}",
+                           sub,
+                           sup);
                     errors.push(ConcreteFailure((*origin).clone(), sub, sup));
                 }
 
@@ -1432,10 +1431,10 @@ fn free_regions_first(a: &RegionAndOrigin,
         self.tcx.sess.span_bug(
             (*self.var_origins.borrow())[node_idx.index as usize].span(),
             &format!("collect_error_for_expanding_node() could not find error \
-                    for var {:?}, lower_bounds={}, upper_bounds={}",
+                    for var {:?}, lower_bounds={:?}, upper_bounds={:?}",
                     node_idx,
-                    lower_bounds.repr(),
-                    upper_bounds.repr()));
+                    lower_bounds,
+                    upper_bounds));
     }
 
     fn collect_error_for_contracting_node(
@@ -1479,9 +1478,9 @@ fn collect_error_for_contracting_node(
         self.tcx.sess.span_bug(
             (*self.var_origins.borrow())[node_idx.index as usize].span(),
             &format!("collect_error_for_contracting_node() could not find error \
-                     for var {:?}, upper_bounds={}",
+                     for var {:?}, upper_bounds={:?}",
                     node_idx,
-                    upper_bounds.repr()));
+                    upper_bounds));
     }
 
     fn collect_concrete_regions(&self,
@@ -1579,8 +1578,8 @@ fn iterate_until_fixed_point<F>(&self, tag: &str, mut body: F) where
             for (constraint, _) in self.constraints.borrow().iter() {
                 let edge_changed = body(constraint);
                 if edge_changed {
-                    debug!("Updated due to constraint {}",
-                           constraint.repr());
+                    debug!("Updated due to constraint {:?}",
+                           constraint);
                     changed = true;
                 }
             }
@@ -1620,9 +1619,9 @@ fn lookup(values: &Vec<VarValue>, rid: ty::RegionVid) -> ty::Region {
 
 impl<'tcx> fmt::Debug for RegionAndOrigin<'tcx> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        write!(f, "RegionAndOrigin({},{})",
-               self.region.repr(),
-               self.origin.repr())
+        write!(f, "RegionAndOrigin({:?},{:?})",
+               self.region,
+               self.origin)
     }
 }
 
index c22aa6a4f996e679d87503595743495474ba5fe5..b67437fd12781d0c2e9791e01504e0eca95fa779 100644 (file)
@@ -11,7 +11,6 @@
 use super::{InferCtxt, fixup_err, fres, unresolved_ty, unresolved_int_ty, unresolved_float_ty};
 use middle::ty::{self, Ty};
 use middle::ty_fold::{self, TypeFoldable};
-use util::ppaux::Repr;
 
 ///////////////////////////////////////////////////////////////////////////
 // OPPORTUNISTIC TYPE RESOLVER
@@ -95,8 +94,8 @@ 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()));
+                        &format!("Unexpected type in full type resolver: {:?}",
+                                t));
                 }
                 _ => {
                     ty_fold::super_fold_ty(self, t)
index 24eae6307fafdfced0ebda4ee1066ac673506123..2b7f9a74b8bd5af568beb401d22f9a0445a3f751 100644 (file)
@@ -16,7 +16,6 @@
 use middle::ty::{self, Ty};
 use middle::ty::TyVar;
 use middle::ty_relate::{Relate, RelateResult, TypeRelation};
-use util::ppaux::{Repr};
 
 /// "Greatest lower bound" (common subtype)
 pub struct Sub<'a, 'tcx: 'a> {
@@ -49,7 +48,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(), b.repr());
+        debug!("{}.tys({:?}, {:?})", self.tag(), a, b);
 
         if a == b { return Ok(a); }
 
@@ -85,10 +84,10 @@ 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({}, {})",
+        debug!("{}.regions({:?}, {:?})",
                self.tag(),
-               a.repr(),
-               b.repr());
+               a,
+               b);
         let origin = Subtype(self.fields.trace.clone());
         self.fields.infcx.region_vars.make_subregion(origin, a, b);
         Ok(a)
index 6ff774b4bb01f211b2393830882ed9e5f185bdac..c4d924d676c89ff93d8bd0999c546c9e46801a17 100644 (file)
@@ -14,7 +14,6 @@
 use middle::subst::{Subst, Substs, EnumeratedItems};
 use middle::ty::{TransmuteRestriction, ctxt, TyBareFn};
 use middle::ty::{self, Ty};
-use util::ppaux::Repr;
 
 use std::fmt;
 
@@ -204,15 +203,15 @@ fn with_each_combination(&self,
 
         match types_in_scope.next() {
             None => {
-                debug!("with_each_combination(substs={})",
-                       substs.repr());
+                debug!("with_each_combination(substs={:?})",
+                       substs);
 
                 callback(substs);
             }
 
             Some((space, index, &param_ty)) => {
-                debug!("with_each_combination: space={:?}, index={}, param_ty={}",
-                       space, index, param_ty.repr());
+                debug!("with_each_combination: space={:?}, index={}, param_ty={:?}",
+                       space, index, param_ty);
 
                 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");
@@ -230,7 +229,7 @@ fn with_each_combination(&self,
     }
 
     fn push_transmute_restriction(&self, restriction: TransmuteRestriction<'tcx>) {
-        debug!("Pushing transmute restriction: {}", restriction.repr());
+        debug!("Pushing transmute restriction: {:?}", restriction);
         self.tcx.transmute_restrictions.borrow_mut().push(restriction);
     }
 }
index 935c077b6338f42defc946ae14229e9f6e74da42..ca8de74b35bda68072c5cff84a29a139bd9f977a 100644 (file)
 use middle::region;
 use middle::ty::{self, Ty};
 use util::nodemap::NodeMap;
-use util::ppaux::{Repr, UserString};
 
 use syntax::ast::{MutImmutable, MutMutable};
 use syntax::ast;
 use syntax::codemap::Span;
-use syntax::print::pprust;
 
 use std::cell::RefCell;
 use std::fmt;
@@ -435,8 +433,8 @@ fn pat_ty(&self, pat: &ast::Pat) -> McResult<Ty<'tcx>> {
             }
             _ => base_ty,
         };
-        debug!("pat_ty(pat={}) base_ty={} ret_ty={}",
-               pat.repr(), base_ty.repr(), ret_ty.repr());
+        debug!("pat_ty(pat={:?}) base_ty={:?} ret_ty={:?}",
+               pat, base_ty, ret_ty);
         Ok(ret_ty)
     }
 
@@ -459,9 +457,9 @@ pub fn cat_expr(&self, expr: &ast::Expr) -> McResult<cmt<'tcx>> {
                     ty::AdjustReifyFnPointer |
                     ty::AdjustUnsafeFnPointer |
                     ty::AdjustDerefRef(_) => {
-                        debug!("cat_expr({}): {}",
-                               adjustment.repr(),
-                               expr.repr());
+                        debug!("cat_expr({:?}): {:?}",
+                               adjustment,
+                               expr);
                         // Result is an rvalue.
                         let expr_ty = try!(self.expr_ty_adjusted(expr));
                         Ok(self.cat_rvalue_node(expr.id(), expr.span(), expr_ty))
@@ -476,9 +474,9 @@ pub fn cat_expr_autoderefd(&self,
                                autoderefs: usize)
                                -> McResult<cmt<'tcx>> {
         let mut cmt = try!(self.cat_expr_unadjusted(expr));
-        debug!("cat_expr_autoderefd: autoderefs={}, cmt={}",
+        debug!("cat_expr_autoderefd: autoderefs={}, cmt={:?}",
                autoderefs,
-               cmt.repr());
+               cmt);
         for deref in 1..autoderefs + 1 {
             cmt = try!(self.cat_deref(expr, cmt, deref, None));
         }
@@ -486,7 +484,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());
+        debug!("cat_expr: id={} expr={:?}", expr.id, expr);
 
         let expr_ty = try!(self.expr_ty(expr));
         match expr.node {
@@ -497,10 +495,10 @@ pub fn cat_expr_unadjusted(&self, expr: &ast::Expr) -> McResult<cmt<'tcx>> {
 
           ast::ExprField(ref base, f_name) => {
             let base_cmt = try!(self.cat_expr(&**base));
-            debug!("cat_expr(cat_field): id={} expr={} base={}",
+            debug!("cat_expr(cat_field): id={} expr={:?} base={:?}",
                    expr.id,
-                   expr.repr(),
-                   base_cmt.repr());
+                   expr,
+                   base_cmt);
             Ok(self.cat_field(expr, base_cmt, f_name.node.name, expr_ty))
           }
 
@@ -523,8 +521,8 @@ pub fn cat_expr_unadjusted(&self, expr: &ast::Expr) -> McResult<cmt<'tcx>> {
                     let elem_ty = match ret_ty.sty {
                         ty::TyRef(_, mt) => mt.ty,
                         _ => {
-                            debug!("cat_expr_unadjusted: return type of overloaded index is {}?",
-                                   ret_ty.repr());
+                            debug!("cat_expr_unadjusted: return type of overloaded index is {:?}?",
+                                   ret_ty);
                             return Err(());
                         }
                     };
@@ -582,8 +580,8 @@ pub fn cat_def(&self,
                    expr_ty: Ty<'tcx>,
                    def: def::Def)
                    -> McResult<cmt<'tcx>> {
-        debug!("cat_def: id={} expr={} def={:?}",
-               id, expr_ty.repr(), def);
+        debug!("cat_def: id={} expr={:?} def={:?}",
+               id, expr_ty, def);
 
         match def {
           def::DefStruct(..) | def::DefVariant(..) | def::DefConst(..) |
@@ -634,9 +632,9 @@ pub fn cat_def(&self,
                   _ => {
                       self.tcx().sess.span_bug(
                           span,
-                          &format!("Upvar of non-closure {} - {}",
+                          &format!("Upvar of non-closure {} - {:?}",
                                   fn_node_id,
-                                  ty.repr()));
+                                  ty));
                   }
               }
           }
@@ -745,7 +743,7 @@ fn cat_upvar(&self,
         };
 
         let ret = Rc::new(cmt_result);
-        debug!("cat_upvar ret={}", ret.repr());
+        debug!("cat_upvar ret={:?}", ret);
         Ok(ret)
     }
 
@@ -816,7 +814,7 @@ fn env_deref(&self,
             note: NoteClosureEnv(upvar_id)
         };
 
-        debug!("env_deref ret {}", ret.repr());
+        debug!("env_deref ret {:?}", ret);
 
         ret
     }
@@ -854,7 +852,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());
+        debug!("cat_rvalue_node ret {:?}", ret);
         ret
     }
 
@@ -871,7 +869,7 @@ pub fn cat_rvalue(&self,
             ty:expr_ty,
             note: NoteNone
         });
-        debug!("cat_rvalue ret {}", ret.repr());
+        debug!("cat_rvalue ret {:?}", ret);
         ret
     }
 
@@ -889,7 +887,7 @@ pub fn cat_field<N:ast_node>(&self,
             ty: f_ty,
             note: NoteNone
         });
-        debug!("cat_field ret {}", ret.repr());
+        debug!("cat_field ret {:?}", ret);
         ret
     }
 
@@ -907,7 +905,7 @@ pub fn cat_tup_field<N:ast_node>(&self,
             ty: f_ty,
             note: NoteNone
         });
-        debug!("cat_tup_field ret {}", ret.repr());
+        debug!("cat_tup_field ret {:?}", ret);
         ret
     }
 
@@ -924,7 +922,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()));
+               method_call, method_ty.map(|ty| ty));
 
         let base_cmt = match method_ty {
             Some(method_ty) => {
@@ -942,12 +940,12 @@ fn cat_deref<N:ast_node>(&self,
                                               mt.ty,
                                               deref_context,
                                                 /* implicit: */ false);
-                debug!("cat_deref ret {}", ret.repr());
+                debug!("cat_deref ret {:?}", ret);
                 ret
             }
             None => {
-                debug!("Explicit deref of non-derefable type: {}",
-                       base_cmt_ty.repr());
+                debug!("Explicit deref of non-derefable type: {:?}",
+                       base_cmt_ty);
                 return Err(());
             }
         }
@@ -990,7 +988,7 @@ fn cat_deref_common<N:ast_node>(&self,
             ty: deref_ty,
             note: NoteNone
         });
-        debug!("cat_deref_common ret {}", ret.repr());
+        debug!("cat_deref_common ret {:?}", ret);
         Ok(ret)
     }
 
@@ -1041,7 +1039,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());
+        debug!("cat_index ret {:?}", ret);
         return Ok(ret);
 
         fn interior<'tcx, N: ast_node>(elt: &N,
@@ -1095,7 +1093,7 @@ fn deref_vec<N:ast_node>(&self,
                 base_cmt
             }
         };
-        debug!("deref_vec ret {}", ret.repr());
+        debug!("deref_vec ret {:?}", ret);
         Ok(ret)
     }
 
@@ -1154,7 +1152,7 @@ pub fn cat_imm_interior<N:ast_node>(&self,
             ty: interior_ty,
             note: NoteNone
         });
-        debug!("cat_imm_interior ret={}", ret.repr());
+        debug!("cat_imm_interior ret={:?}", ret);
         ret
     }
 
@@ -1172,7 +1170,7 @@ pub fn cat_downcast<N:ast_node>(&self,
             ty: downcast_ty,
             note: NoteNone
         });
-        debug!("cat_downcast ret={}", ret.repr());
+        debug!("cat_downcast ret={:?}", ret);
         ret
     }
 
@@ -1232,9 +1230,9 @@ fn cat_pattern_<F>(&self, cmt: cmt<'tcx>, pat: &ast::Pat, op: &mut F)
         // step out of sync again. So you'll see below that we always
         // get the type of the *subpattern* and use that.
 
-        debug!("cat_pattern: id={} pat={} cmt={}",
-               pat.id, pprust::pat_to_string(pat),
-               cmt.repr());
+        debug!("cat_pattern: {:?} cmt={:?}",
+               pat,
+               cmt);
 
         (*op)(self, cmt.clone(), pat);
 
@@ -1520,7 +1518,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()
+                        var.to_string()
                     }
                     Some(_) => unreachable!(),
                     None => {
@@ -1560,7 +1558,7 @@ pub fn descriptive_string(&self, tcx: &ty::ctxt) -> String {
                 "pattern-bound indexed content".to_string()
             }
             cat_upvar(ref var) => {
-                var.user_string()
+                var.to_string()
             }
             cat_downcast(ref cmt, _) => {
                 cmt.descriptive_string(tcx)
index 3fec62cd8b481b8a8bf6669fe336bce81068f3c0..3f00d9ba5e98d149cd9c5d94b7bce402d533a76f 100644 (file)
@@ -28,7 +28,6 @@
 use syntax::visit::{FnKind, Visitor};
 use syntax::feature_gate::emit_feature_err;
 use util::nodemap::{DefIdMap, FnvHashSet, FnvHashMap};
-use util::ppaux::Repr;
 
 use std::mem::replace;
 
@@ -450,7 +449,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()));
+                                               type_));
                 }
             }
         }
@@ -551,7 +550,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());
+    debug!("lookup(id={:?})", id);
 
     // is this definition the implementation of a trait method?
     match ty::trait_item_of_item(tcx, id) {
index 957bd76bb94269710aa2a41e558e9ab812f463c7..c3c29d0ade8dfb0e64b5403f1c902bb48111ec86 100644 (file)
@@ -15,7 +15,6 @@
 
 use middle::ty::{self, Ty};
 use middle::ty_fold::{self, TypeFoldable, TypeFolder};
-use util::ppaux::Repr;
 
 use std::fmt;
 use std::iter::IntoIterator;
@@ -618,10 +617,10 @@ fn fold_region(&mut self, r: ty::Region) -> ty::Region {
                                 self.tcx().sess.span_bug(
                                     span,
                                     &format!("Type parameter out of range \
-                                              when substituting in region {} (root type={}) \
+                                              when substituting in region {} (root type={:?}) \
                                               (space={:?}, index={})",
-                                             data.name.as_str(),
-                                             self.root_ty.repr(),
+                                             data.name,
+                                             self.root_ty,
                                              data.space,
                                              data.index));
                             }
@@ -673,14 +672,14 @@ fn ty_for_param(&self, p: ty::ParamTy, source_ty: Ty<'tcx>) -> Ty<'tcx> {
                 let span = self.span.unwrap_or(DUMMY_SP);
                 self.tcx().sess.span_bug(
                     span,
-                    &format!("Type parameter `{}` ({}/{:?}/{}) out of range \
-                                 when substituting (root type={}) substs={}",
-                            p.repr(),
-                            source_ty.repr(),
+                    &format!("Type parameter `{:?}` ({:?}/{:?}/{}) out of range \
+                                 when substituting (root type={:?}) substs={:?}",
+                            p,
+                            source_ty,
                             p.space,
                             p.idx,
-                            self.root_ty.repr(),
-                            self.substs.repr()));
+                            self.root_ty,
+                            self.substs));
             }
         };
 
@@ -731,14 +730,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.region_binders_passed, ty::type_has_escaping_regions(ty));
+               ty, 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());
+        debug!("shift_regions: shifted result = {:?}", result);
 
         result
     }
index 622ed134a6091c8ba64bb1a7c8cfcfd4b1f4c376..a826836b10c62c181accd85e1c82eef74bc5b9a4 100644 (file)
@@ -22,7 +22,6 @@
 use middle::infer::{self, InferCtxt};
 use syntax::ast;
 use syntax::codemap::{DUMMY_SP, Span};
-use util::ppaux::Repr;
 
 #[derive(Copy, Clone)]
 struct InferIsLocal(bool);
@@ -34,10 +33,10 @@ pub fn overlapping_impls(infcx: &InferCtxt,
                          -> bool
 {
     debug!("impl_can_satisfy(\
-           impl1_def_id={}, \
-           impl2_def_id={})",
-           impl1_def_id.repr(),
-           impl2_def_id.repr());
+           impl1_def_id={:?}, \
+           impl2_def_id={:?})",
+           impl1_def_id,
+           impl2_def_id);
 
     let param_env = &ty::empty_parameter_environment(infcx.tcx);
     let selcx = &mut SelectionContext::intercrate(infcx, param_env);
@@ -53,9 +52,9 @@ fn overlap(selcx: &mut SelectionContext,
            b_def_id: ast::DefId)
            -> bool
 {
-    debug!("overlap(a_def_id={}, b_def_id={})",
-           a_def_id.repr(),
-           b_def_id.repr());
+    debug!("overlap(a_def_id={:?}, b_def_id={:?})",
+           a_def_id,
+           b_def_id);
 
     let (a_trait_ref, a_obligations) = impl_trait_ref_and_oblig(selcx,
                                                                 a_def_id,
@@ -65,9 +64,9 @@ fn overlap(selcx: &mut SelectionContext,
                                                                 b_def_id,
                                                                 util::fresh_type_vars_for_impl);
 
-    debug!("overlap: a_trait_ref={}", a_trait_ref.repr());
+    debug!("overlap: a_trait_ref={:?}", a_trait_ref);
 
-    debug!("overlap: b_trait_ref={}", b_trait_ref.repr());
+    debug!("overlap: b_trait_ref={:?}", b_trait_ref);
 
     // Does `a <: b` hold? If not, no overlap.
     if let Err(_) = infer::mk_sub_poly_trait_refs(selcx.infcx(),
@@ -89,7 +88,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());
+        debug!("overlap: obligation unsatisfiable {:?}", failing_obligation);
         return false
     }
 
@@ -98,7 +97,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());
+    debug!("trait_ref_is_knowable(trait_ref={:?})", trait_ref);
 
     // if the orphan rules pass, that means that no ancestor crate can
     // impl this, so it's up to us.
@@ -180,17 +179,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());
+    debug!("orphan_check({:?})", impl_def_id);
 
     // 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());
+    debug!("orphan_check: trait_ref={:?}", trait_ref);
 
     // 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());
+        debug!("trait {:?} is local to current crate",
+               trait_ref.def_id);
         return Ok(());
     }
 
@@ -202,8 +201,8 @@ fn orphan_check_trait_ref<'tcx>(tcx: &ty::ctxt<'tcx>,
                                 infer_is_local: InferIsLocal)
                                 -> Result<(), OrphanCheckErr<'tcx>>
 {
-    debug!("orphan_check_trait_ref(trait_ref={}, infer_is_local={})",
-           trait_ref.repr(), infer_is_local.0);
+    debug!("orphan_check_trait_ref(trait_ref={:?}, infer_is_local={})",
+           trait_ref, infer_is_local.0);
 
     // First, create an ordered iterator over all the type parameters to the trait, with the self
     // type appearing first.
@@ -214,14 +213,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());
+            debug!("orphan_check_trait_ref: ty_is_local `{:?}`", input_ty);
 
             // 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());
+                    debug!("orphan_check_trait_ref: uncovered type `{:?}`", param);
                     return Err(OrphanCheckErr::UncoveredTy(param));
                 }
             }
@@ -234,7 +233,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());
+                debug!("orphan_check_trait_ref: uncovered type `{:?}`", param);
                 return Err(OrphanCheckErr::UncoveredTy(param));
             }
         }
@@ -294,7 +293,7 @@ fn ty_is_local_constructor<'tcx>(tcx: &ty::ctxt<'tcx>,
                                  infer_is_local: InferIsLocal)
                                  -> bool
 {
-    debug!("ty_is_local_constructor({})", ty.repr());
+    debug!("ty_is_local_constructor({:?})", ty);
 
     match ty.sty {
         ty::TyBool |
@@ -335,8 +334,8 @@ fn ty_is_local_constructor<'tcx>(tcx: &ty::ctxt<'tcx>,
         ty::TyClosure(..) |
         ty::TyError => {
             tcx.sess.bug(
-                &format!("ty_is_local invoked on unexpected type: {}",
-                        ty.repr()))
+                &format!("ty_is_local invoked on unexpected type: {:?}",
+                        ty))
         }
     }
 }
index 7d4bbb5d7f03f2939f611e9b6ed32233e497efcd..8618f5215290769924d31ce6813b1b6171de2b40 100644 (file)
@@ -28,9 +28,9 @@
 use middle::ty::{self, AsPredicate, ReferencesError, ToPolyTraitRef, TraitRef};
 use middle::ty_fold::TypeFoldable;
 use std::collections::HashMap;
+use std::fmt;
 use syntax::codemap::{DUMMY_SP, Span};
 use syntax::attr::{AttributeMethods, AttrMetaMethods};
-use util::ppaux::{Repr, UserString};
 
 pub fn report_fulfillment_errors<'a, 'tcx>(infcx: &InferCtxt<'a, 'tcx>,
                                            errors: &Vec<FulfillmentError<'tcx>>) {
@@ -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(),
+                predicate,
                 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();
+            let trait_str = def.trait_ref.to_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())
+                                                         .to_string())
                                               }).collect::<HashMap<String, String>>();
                 generic_map.insert("Self".to_string(),
-                                   trait_ref.self_ty().user_string());
+                                   trait_ref.self_ty().to_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 + TypeFoldable<'tcx>
+    where T: fmt::Display + 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());
+              predicate);
 
     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());;
+                            obligation.predicate);;
                 }
                 _ => {
                     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(),
-                                        trait_ref.self_ty().user_string());
+                                        trait_ref,
+                                        trait_ref.self_ty());
                                 // 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(),
+                                    predicate,
                                     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(),
+                                    predicate,
                                     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());
+                                        predicate);
                         }
                     }
                 }
@@ -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(),
-                        expected_trait_ref.user_string(),
-                        actual_trait_ref.user_string(),
+                        expected_trait_ref.self_ty(),
+                        expected_trait_ref,
+                        actual_trait_ref,
                         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()));
+                                    method.name));
                     }
 
                     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()));
+                                    method.name));
                     }
 
                     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()));
+                                    method.name));
                     }
                 }
             }
@@ -316,9 +316,9 @@ 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(),
-           obligation.repr());
+    debug!("maybe_report_ambiguity(predicate={:?}, obligation={:?})",
+           predicate,
+           obligation);
 
     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());
+                                self_ty);
                     } else {
                         span_err!(infcx.tcx.sess, obligation.cause.span, E0283,
                                 "type annotations required: cannot resolve `{}`",
-                                predicate.user_string());;
+                                predicate);;
                         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(),
-                        self_ty.user_string()));
+                        trait_ref,
+                        self_ty));
             }
         }
 
@@ -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());;
+                        predicate);;
                 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
+    where T: fmt::Display
 {
     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
+    where T: fmt::Display
 {
     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());
+                       parent_trait_ref.0.self_ty());
             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(),
-                       parent_trait_ref.0.self_ty().user_string());
+                       parent_trait_ref,
+                       parent_trait_ref.0.self_ty());
             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());
+                      predicate);
         }
     }
 }
index 0828a67c6c678f96552fb265dcdf8ee7d54f7cd1..593a71a30fe2a11ae5dd86609b4df3e2b088d4d7 100644 (file)
@@ -15,7 +15,6 @@
 use std::fmt;
 use syntax::ast;
 use util::common::ErrorReported;
-use util::ppaux::Repr;
 use util::nodemap::NodeMap;
 
 use super::CodeAmbiguity;
@@ -138,8 +137,8 @@ pub fn normalize_projection_type<'a>(&mut self,
                                          cause: ObligationCause<'tcx>)
                                          -> Ty<'tcx>
     {
-        debug!("normalize_associated_type(projection_ty={})",
-               projection_ty.repr());
+        debug!("normalize_associated_type(projection_ty={:?})",
+               projection_ty);
 
         assert!(!projection_ty.has_escaping_regions());
 
@@ -152,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());
+        debug!("normalize_associated_type: result={:?}", normalized.value);
 
         normalized.value
     }
@@ -190,11 +189,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());
+            debug!("register_predicate({:?}) -- already seen, skip", obligation);
             return;
         }
 
-        debug!("register_predicate({})", obligation.repr());
+        debug!("register_predicate({:?})", obligation);
         self.predicates.push(obligation);
     }
 
@@ -378,9 +377,9 @@ fn process_predicate<'a,'tcx>(selcx: &mut SelectionContext<'a,'tcx>,
                     true
                 }
                 Err(selection_err) => {
-                    debug!("predicate: {} error: {}",
-                           obligation.repr(),
-                           selection_err.repr());
+                    debug!("predicate: {:?} error: {:?}",
+                           obligation,
+                           selection_err);
                     errors.push(
                         FulfillmentError::new(
                             obligation.clone(),
@@ -439,9 +438,9 @@ fn process_predicate<'a,'tcx>(selcx: &mut SelectionContext<'a,'tcx>,
         ty::Predicate::Projection(ref data) => {
             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(),
-                   result.repr());
+            debug!("process_predicate: poly_project_and_unify_type({:?}) returned {:?}",
+                   project_obligation,
+                   result);
             match result {
                 Ok(Some(obligations)) => {
                     new_obligations.extend(obligations);
@@ -479,8 +478,8 @@ fn register_region_obligation<'tcx>(t_a: Ty<'tcx>,
                                                sub_region: r_b,
                                                cause: cause };
 
-    debug!("register_region_obligation({})",
-           region_obligation.repr());
+    debug!("register_region_obligation({:?})",
+           region_obligation);
 
     region_obligations.entry(region_obligation.cause.body_id).or_insert(vec![])
         .push(region_obligation);
index 35855767e609882e15018ab400dd3ad023198bc9..e3c122e2f1f59319f6dc3291c0510af5f8a50222 100644 (file)
@@ -23,7 +23,6 @@
 use std::rc::Rc;
 use syntax::ast;
 use syntax::codemap::{Span, DUMMY_SP};
-use util::ppaux::Repr;
 
 pub use self::error_reporting::report_fulfillment_errors;
 pub use self::error_reporting::report_overflow_error;
@@ -319,8 +318,8 @@ pub fn type_known_to_meet_builtin_bound<'a,'tcx>(infcx: &InferCtxt<'a,'tcx>,
                                                  span: Span)
                                                  -> bool
 {
-    debug!("type_known_to_meet_builtin_bound(ty={}, bound={:?})",
-           ty.repr(),
+    debug!("type_known_to_meet_builtin_bound(ty={:?}, bound={:?})",
+           ty,
            bound);
 
     let mut fulfill_cx = FulfillmentContext::new(false);
@@ -337,16 +336,16 @@ pub fn type_known_to_meet_builtin_bound<'a,'tcx>(infcx: &InferCtxt<'a,'tcx>,
     // assume it is move; linear is always ok.
     match fulfill_cx.select_all_or_error(infcx, typer) {
         Ok(()) => {
-            debug!("type_known_to_meet_builtin_bound: ty={} bound={:?} success",
-                   ty.repr(),
+            debug!("type_known_to_meet_builtin_bound: ty={:?} bound={:?} success",
+                   ty,
                    bound);
             true
         }
         Err(e) => {
-            debug!("type_known_to_meet_builtin_bound: ty={} bound={:?} errors={}",
-                   ty.repr(),
+            debug!("type_known_to_meet_builtin_bound: ty={:?} bound={:?} errors={:?}",
+                   ty,
                    bound,
-                   e.repr());
+                   e);
             false
         }
     }
@@ -376,8 +375,8 @@ pub fn normalize_param_env_or_error<'a,'tcx>(unnormalized_env: ty::ParameterEnvi
     let span = cause.span;
     let body_id = cause.body_id;
 
-    debug!("normalize_param_env_or_error(unnormalized_env={})",
-           unnormalized_env.repr());
+    debug!("normalize_param_env_or_error(unnormalized_env={:?})",
+           unnormalized_env);
 
     let predicates: Vec<_> =
         util::elaborate_predicates(tcx, unnormalized_env.caller_bounds.clone())
@@ -392,8 +391,8 @@ pub fn normalize_param_env_or_error<'a,'tcx>(unnormalized_env: ty::ParameterEnvi
     // constructed, but I am not currently doing so out of laziness.
     // -nmatsakis
 
-    debug!("normalize_param_env_or_error: elaborated-predicates={}",
-           predicates.repr());
+    debug!("normalize_param_env_or_error: elaborated-predicates={:?}",
+           predicates);
 
     let elaborated_env = unnormalized_env.with_caller_bounds(predicates);
 
@@ -435,21 +434,21 @@ pub fn fully_normalize<'a,'tcx,T>(infcx: &InferCtxt<'a,'tcx>,
                                   -> Result<T, Vec<FulfillmentError<'tcx>>>
     where T : TypeFoldable<'tcx> + HasProjectionTypes
 {
-    debug!("normalize_param_env(value={})", value.repr());
+    debug!("normalize_param_env(value={:?})", value);
 
     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(),
-           obligations.repr());
+    debug!("normalize_param_env: normalized_value={:?} obligations={:?}",
+           normalized_value,
+           obligations);
     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());
+    debug!("normalize_param_env: resolved_value={:?}", resolved_value);
     Ok(resolved_value)
 }
 
index daa03c5160c01396b43498949a9617c59a409b2c..afb30716c36697b50955d1f5fcb4ec0f4c0fa07c 100644 (file)
@@ -25,7 +25,6 @@
 use middle::ty::{self, ToPolyTraitRef, Ty};
 use std::rc::Rc;
 use syntax::ast;
-use util::ppaux::Repr;
 
 #[derive(Debug)]
 pub enum ObjectSafetyViolation<'tcx> {
@@ -71,7 +70,7 @@ pub fn is_object_safe<'tcx>(tcx: &ty::ctxt<'tcx>,
         result
     });
 
-    debug!("is_object_safe({}) = {}", trait_def_id.repr(), result);
+    debug!("is_object_safe({:?}) = {}", trait_def_id, result);
 
     result
 }
@@ -112,9 +111,9 @@ fn object_safety_violations_for_trait<'tcx>(tcx: &ty::ctxt<'tcx>,
         violations.push(ObjectSafetyViolation::SupertraitSelf);
     }
 
-    debug!("object_safety_violations_for_trait(trait_def_id={}) = {}",
-           trait_def_id.repr(),
-           violations.repr());
+    debug!("object_safety_violations_for_trait(trait_def_id={:?}) = {:?}",
+           trait_def_id,
+           violations);
 
     violations
 }
index 967edabc0b9c1ab364b4b255d5bb6b56eb6d1458..3ac58dafa4a7a25807825eb90ad3e5784cd772d5 100644 (file)
@@ -28,7 +28,6 @@
 use middle::ty_fold::{self, TypeFoldable, TypeFolder};
 use syntax::parse::token;
 use util::common::FN_OUTPUT_NAME;
-use util::ppaux::Repr;
 
 use std::fmt;
 
@@ -79,8 +78,8 @@ pub fn poly_project_and_unify_type<'cx,'tcx>(
     obligation: &PolyProjectionObligation<'tcx>)
     -> Result<Option<Vec<PredicateObligation<'tcx>>>, MismatchedProjectionTypes<'tcx>>
 {
-    debug!("poly_project_and_unify_type(obligation={})",
-           obligation.repr());
+    debug!("poly_project_and_unify_type(obligation={:?})",
+           obligation);
 
     let infcx = selcx.infcx();
     infcx.commit_if_ok(|snapshot| {
@@ -112,8 +111,8 @@ fn project_and_unify_type<'cx,'tcx>(
     obligation: &ProjectionObligation<'tcx>)
     -> Result<Option<Vec<PredicateObligation<'tcx>>>, MismatchedProjectionTypes<'tcx>>
 {
-    debug!("project_and_unify_type(obligation={})",
-           obligation.repr());
+    debug!("project_and_unify_type(obligation={:?})",
+           obligation);
 
     let Normalized { value: normalized_ty, obligations } =
         match opt_normalize_projection_type(selcx,
@@ -127,9 +126,9 @@ fn project_and_unify_type<'cx,'tcx>(
             }
         };
 
-    debug!("project_and_unify_type: normalized_ty={} obligations={}",
-           normalized_ty.repr(),
-           obligations.repr());
+    debug!("project_and_unify_type: normalized_ty={:?} obligations={:?}",
+           normalized_ty,
+           obligations);
 
     let infcx = selcx.infcx();
     let origin = infer::RelateOutputImplTypes(obligation.cause.span);
@@ -141,8 +140,8 @@ 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());
+    debug!("consider_unification_despite_ambiguity(obligation={:?})",
+           obligation);
 
     let def_id = obligation.predicate.projection_ty.trait_ref.def_id;
     match selcx.tcx().lang_items.fn_trait_kind(def_id) {
@@ -176,7 +175,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());
+                   ret_type);
             let origin = infer::RelateOutputImplTypes(obligation.cause.span);
             let obligation_ty = obligation.predicate.ty;
             match infer::mk_eqty(infcx, true, origin, obligation_ty, ret_type) {
@@ -357,9 +356,9 @@ fn opt_normalize_projection_type<'a,'b,'tcx>(
     -> Option<NormalizedTy<'tcx>>
 {
     debug!("normalize_projection_type(\
-           projection_ty={}, \
+           projection_ty={:?}, \
            depth={})",
-           projection_ty.repr(),
+           projection_ty,
            depth);
 
     let obligation = Obligation::with_depth(cause.clone(), depth, projection_ty.clone());
@@ -370,17 +369,17 @@ fn opt_normalize_projection_type<'a,'b,'tcx>(
             // an impl, where-clause etc) and hence we must
             // re-normalize it
 
-            debug!("normalize_projection_type: projected_ty={} depth={} obligations={}",
-                   projected_ty.repr(),
+            debug!("normalize_projection_type: projected_ty={:?} depth={} obligations={:?}",
+                   projected_ty,
                    depth,
-                   obligations.repr());
+                   obligations);
 
             if ty::type_has_projection(projected_ty) {
                 let mut normalizer = AssociatedTypeNormalizer::new(selcx, cause, depth);
                 let normalized_ty = normalizer.fold(&projected_ty);
 
-                debug!("normalize_projection_type: normalized_ty={} depth={}",
-                       normalized_ty.repr(),
+                debug!("normalize_projection_type: normalized_ty={:?} depth={}",
+                       normalized_ty,
                        depth);
 
                 obligations.extend(normalizer.obligations);
@@ -396,8 +395,8 @@ fn opt_normalize_projection_type<'a,'b,'tcx>(
             }
         }
         Ok(ProjectedTy::NoProgress(projected_ty)) => {
-            debug!("normalize_projection_type: projected_ty={} no progress",
-                   projected_ty.repr());
+            debug!("normalize_projection_type: projected_ty={:?} no progress",
+                   projected_ty);
             Some(Normalized {
                 value: projected_ty,
                 obligations: vec!()
@@ -451,8 +450,8 @@ fn project_type<'cx,'tcx>(
     obligation: &ProjectionTyObligation<'tcx>)
     -> Result<ProjectedTy<'tcx>, ProjectionTyError<'tcx>>
 {
-    debug!("project(obligation={})",
-           obligation.repr());
+    debug!("project(obligation={:?})",
+           obligation);
 
     let recursion_limit = selcx.tcx().sess.recursion_limit.get();
     if obligation.recursion_depth >= recursion_limit {
@@ -463,7 +462,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());
+    debug!("project: obligation_trait_ref={:?}", obligation_trait_ref);
 
     if obligation_trait_ref.references_error() {
         return Ok(ProjectedTy::Progress(selcx.tcx().types.err, vec!()));
@@ -591,12 +590,12 @@ fn assemble_candidates_from_predicates<'cx,'tcx,I>(
     env_predicates: I)
     where I: Iterator<Item=ty::Predicate<'tcx>>
 {
-    debug!("assemble_candidates_from_predicates(obligation={})",
-           obligation.repr());
+    debug!("assemble_candidates_from_predicates(obligation={:?})",
+           obligation);
     let infcx = selcx.infcx();
     for predicate in env_predicates {
-        debug!("assemble_candidates_from_predicates: predicate={}",
-               predicate.repr());
+        debug!("assemble_candidates_from_predicates: predicate={:?}",
+               predicate);
         match predicate {
             ty::Predicate::Projection(ref data) => {
                 let same_name = data.item_name() == obligation.predicate.item_name;
@@ -613,10 +612,9 @@ fn assemble_candidates_from_predicates<'cx,'tcx,I>(
                                               obligation_poly_trait_ref).is_ok()
                 });
 
-                debug!("assemble_candidates_from_predicates: candidate {} is_match {} same_name {}",
-                       data.repr(),
-                       is_match,
-                       same_name);
+                debug!("assemble_candidates_from_predicates: candidate={:?} \
+                                                             is_match={} same_name={}",
+                       data, is_match, same_name);
 
                 if is_match {
                     candidate_set.vec.push(
@@ -635,15 +633,15 @@ fn assemble_candidates_from_object_type<'cx,'tcx>(
     candidate_set: &mut ProjectionTyCandidateSet<'tcx>,
     object_ty: Ty<'tcx>)
 {
-    debug!("assemble_candidates_from_object_type(object_ty={})",
-           object_ty.repr());
+    debug!("assemble_candidates_from_object_type(object_ty={:?})",
+           object_ty);
     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()));
+                &format!("assemble_candidates_from_object_type called with non-object: {:?}",
+                         object_ty));
         }
     };
     let projection_bounds = data.projection_bounds_with_self_ty(selcx.tcx(), object_ty);
@@ -673,16 +671,16 @@ fn assemble_candidates_from_impls<'cx,'tcx>(
             return Ok(());
         }
         Err(e) => {
-            debug!("assemble_candidates_from_impls: selection error {}",
-                   e.repr());
+            debug!("assemble_candidates_from_impls: selection error {:?}",
+                   e);
             return Err(e);
         }
     };
 
     match vtable {
         super::VtableImpl(data) => {
-            debug!("assemble_candidates_from_impls: impl candidate {}",
-                   data.repr());
+            debug!("assemble_candidates_from_impls: impl candidate {:?}",
+                   data);
 
             candidate_set.vec.push(
                 ProjectionTyCandidate::Impl(data));
@@ -732,8 +730,8 @@ fn assemble_candidates_from_impls<'cx,'tcx>(
             // These traits have no associated types.
             selcx.tcx().sess.span_bug(
                 obligation.cause.span,
-                &format!("Cannot project an associated type from `{}`",
-                         vtable.repr()));
+                &format!("Cannot project an associated type from `{:?}`",
+                         vtable));
         }
     }
 
@@ -746,9 +744,9 @@ fn confirm_candidate<'cx,'tcx>(
     candidate: ProjectionTyCandidate<'tcx>)
     -> (Ty<'tcx>, Vec<PredicateObligation<'tcx>>)
 {
-    debug!("confirm_candidate(candidate={}, obligation={})",
-           candidate.repr(),
-           obligation.repr());
+    debug!("confirm_candidate(candidate={:?}, obligation={:?})",
+           candidate,
+           obligation);
 
     match candidate {
         ProjectionTyCandidate::ParamEnv(poly_projection) => {
@@ -812,9 +810,9 @@ fn confirm_callable_candidate<'cx,'tcx>(
 {
     let tcx = selcx.tcx();
 
-    debug!("confirm_callable_candidate({},{})",
-           obligation.repr(),
-           fn_sig.repr());
+    debug!("confirm_callable_candidate({:?},{:?})",
+           obligation,
+           fn_sig);
 
     // the `Output` associated type is declared on `FnOnce`
     let fn_once_def_id = tcx.lang_items.fn_once_trait().unwrap();
@@ -864,9 +862,9 @@ fn confirm_param_env_candidate<'cx,'tcx>(
         Err(e) => {
             selcx.tcx().sess.span_bug(
                 obligation.cause.span,
-                &format!("Failed to unify `{}` and `{}` in projection: {}",
-                         obligation.repr(),
-                         projection.repr(),
+                &format!("Failed to unify `{:?}` and `{:?}` in projection: {}",
+                         obligation,
+                         projection,
                          e));
         }
     }
@@ -914,8 +912,8 @@ fn confirm_impl_candidate<'cx,'tcx>(
     }
 
     selcx.tcx().sess.span_bug(obligation.cause.span,
-                              &format!("No associated type for {}",
-                                       trait_ref.repr()));
+                              &format!("No associated type for {:?}",
+                                       trait_ref));
 }
 
 impl<'tcx, T: TypeFoldable<'tcx>> TypeFoldable<'tcx> for Normalized<'tcx, T> {
index 96d48faf9e0922370415f6872e2499e39536b589..1653cac68e6e05a435c0fb6bd93b7d6a1e1eddb3 100644 (file)
@@ -51,7 +51,6 @@
 use syntax::{abi, ast};
 use util::common::ErrorReported;
 use util::nodemap::FnvHashMap;
-use util::ppaux::Repr;
 
 pub struct SelectionContext<'cx, 'tcx:'cx> {
     infcx: &'cx InferCtxt<'cx, 'tcx>,
@@ -300,7 +299,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());
+        debug!("select({:?})", obligation);
         assert!(!obligation.predicate.has_escaping_regions());
 
         let stack = self.push_stack(TraitObligationStackList::empty(), obligation);
@@ -389,8 +388,8 @@ pub fn evaluate_obligation(&mut self,
                                obligation: &PredicateObligation<'tcx>)
                                -> bool
     {
-        debug!("evaluate_obligation({})",
-               obligation.repr());
+        debug!("evaluate_obligation({:?})",
+               obligation);
 
         self.evaluate_predicate_recursively(TraitObligationStackList::empty(), obligation)
             .may_apply()
@@ -442,8 +441,8 @@ fn evaluate_predicate_recursively<'o>(&mut self,
                                           obligation: &PredicateObligation<'tcx>)
                                            -> EvaluationResult<'tcx>
     {
-        debug!("evaluate_predicate_recursively({})",
-               obligation.repr());
+        debug!("evaluate_predicate_recursively({:?})",
+               obligation);
 
         // Check the cache from the tcx of predicates that we know
         // have been proven elsewhere. This cache only contains
@@ -501,8 +500,8 @@ fn evaluate_obligation_recursively<'o>(&mut self,
                                            obligation: &TraitObligation<'tcx>)
                                            -> EvaluationResult<'tcx>
     {
-        debug!("evaluate_obligation_recursively({})",
-               obligation.repr());
+        debug!("evaluate_obligation_recursively({:?})",
+               obligation);
 
         let stack = self.push_stack(previous_stack, obligation);
 
@@ -549,8 +548,8 @@ fn evaluate_stack<'o>(&mut self,
                   |prev| self.match_fresh_trait_refs(&stack.fresh_trait_ref,
                                                      &prev.fresh_trait_ref)))
         {
-            debug!("evaluate_stack({}) --> unbound argument, recursion -->  ambiguous",
-                   stack.fresh_trait_ref.repr());
+            debug!("evaluate_stack({:?}) --> unbound argument, recursion -->  ambiguous",
+                   stack.fresh_trait_ref);
             return EvaluatedToAmbig;
         }
 
@@ -578,8 +577,8 @@ fn evaluate_stack<'o>(&mut self,
             .skip(1) // skip top-most frame
             .any(|prev| stack.fresh_trait_ref == prev.fresh_trait_ref)
         {
-            debug!("evaluate_stack({}) --> recursive",
-                   stack.fresh_trait_ref.repr());
+            debug!("evaluate_stack({:?}) --> recursive",
+                   stack.fresh_trait_ref);
             return EvaluatedToOk;
         }
 
@@ -597,9 +596,9 @@ pub fn evaluate_impl(&mut self,
                          obligation: &TraitObligation<'tcx>)
                          -> bool
     {
-        debug!("evaluate_impl(impl_def_id={}, obligation={})",
-               impl_def_id.repr(),
-               obligation.repr());
+        debug!("evaluate_impl(impl_def_id={:?}, obligation={:?})",
+               impl_def_id,
+               obligation);
 
         self.infcx.probe(|snapshot| {
             match self.match_impl(impl_def_id, obligation, snapshot) {
@@ -645,16 +644,16 @@ fn candidate_from_obligation<'o>(&mut self,
         // with fresh skolemized types starting from index 0.
         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(),
-               stack.repr());
+        debug!("candidate_from_obligation(cache_fresh_trait_pred={:?}, obligation={:?})",
+               cache_fresh_trait_pred,
+               stack);
         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(),
-                       c.repr());
+                debug!("CACHE HIT: cache_fresh_trait_pred={:?}, candidate={:?}",
+                       cache_fresh_trait_pred,
+                       c);
                 return c;
             }
             None => { }
@@ -664,8 +663,8 @@ fn candidate_from_obligation<'o>(&mut self,
         let candidate = self.candidate_from_obligation_no_cache(stack);
 
         if self.should_update_candidate_cache(&cache_fresh_trait_pred, &candidate) {
-            debug!("CACHE MISS: cache_fresh_trait_pred={}, candidate={}",
-                   cache_fresh_trait_pred.repr(), candidate.repr());
+            debug!("CACHE MISS: cache_fresh_trait_pred={:?}, candidate={:?}",
+                   cache_fresh_trait_pred, candidate);
             self.insert_candidate_cache(cache_fresh_trait_pred, candidate.clone());
         }
 
@@ -694,10 +693,10 @@ fn candidate_from_obligation_no_cache<'o>(&mut self,
 
         let mut candidates = candidate_set.vec;
 
-        debug!("assembled {} candidates for {}: {}",
+        debug!("assembled {} candidates for {:?}: {:?}",
                candidates.len(),
-               stack.repr(),
-               candidates.repr());
+               stack,
+               candidates);
 
         // At this point, we know that each of the entries in the
         // candidate set is *individually* applicable. Now we have to
@@ -737,12 +736,12 @@ fn candidate_from_obligation_no_cache<'o>(&mut self,
                     .any(|j| self.candidate_should_be_dropped_in_favor_of(&candidates[i],
                                                                           &candidates[j]));
                 if is_dup {
-                    debug!("Dropping candidate #{}/{}: {}",
-                           i, candidates.len(), candidates[i].repr());
+                    debug!("Dropping candidate #{}/{}: {:?}",
+                           i, candidates.len(), candidates[i]);
                     candidates.swap_remove(i);
                 } else {
-                    debug!("Retaining candidate #{}/{}: {}",
-                           i, candidates.len(), candidates[i].repr());
+                    debug!("Retaining candidate #{}/{}: {:?}",
+                           i, candidates.len(), candidates[i]);
                     i += 1;
                 }
             }
@@ -908,8 +907,8 @@ 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());
+                debug!("obligation self ty is {:?}",
+                       obligation.predicate.0.self_ty());
 
                 // User-defined copy impls are permitted, but only for
                 // structs and enums.
@@ -959,9 +958,9 @@ fn assemble_candidates_from_projected_tys(&mut self,
         let poly_trait_predicate =
             self.infcx().resolve_type_vars_if_possible(&obligation.predicate);
 
-        debug!("assemble_candidates_for_projected_tys({},{})",
-               obligation.repr(),
-               poly_trait_predicate.repr());
+        debug!("assemble_candidates_for_projected_tys({:?},{:?})",
+               obligation,
+               poly_trait_predicate);
 
         // FIXME(#20297) -- just examining the self-type is very simplistic
 
@@ -983,8 +982,8 @@ fn assemble_candidates_from_projected_tys(&mut self,
             _ => { return; }
         };
 
-        debug!("assemble_candidates_for_projected_tys: trait_def_id={}",
-               trait_def_id.repr());
+        debug!("assemble_candidates_for_projected_tys: trait_def_id={:?}",
+               trait_def_id);
 
         let result = self.infcx.probe(|snapshot| {
             self.match_projection_obligation_against_bounds_from_trait(obligation,
@@ -1007,9 +1006,9 @@ fn match_projection_obligation_against_bounds_from_trait(
         let (skol_trait_predicate, skol_map) =
             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(),
-               skol_map.repr());
+                skol_trait_predicate={:?} skol_map={:?}",
+               skol_trait_predicate,
+               skol_map);
 
         let projection_trait_ref = match skol_trait_predicate.trait_ref.self_ty().sty {
             ty::TyProjection(ref data) => &data.trait_ref,
@@ -1017,19 +1016,19 @@ fn match_projection_obligation_against_bounds_from_trait(
                 self.tcx().sess.span_bug(
                     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()));
+                              but self-ty not a projection: {:?}",
+                             skol_trait_predicate.trait_ref.self_ty()));
             }
         };
         debug!("match_projection_obligation_against_bounds_from_trait: \
-                projection_trait_ref={}",
-               projection_trait_ref.repr());
+                projection_trait_ref={:?}",
+               projection_trait_ref);
 
         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());
+                bounds={:?}",
+               bounds);
 
         let matching_bound =
             util::elaborate_predicates(self.tcx(), bounds.predicates.into_vec())
@@ -1043,8 +1042,8 @@ fn match_projection_obligation_against_bounds_from_trait(
                                               snapshot)));
 
         debug!("match_projection_obligation_against_bounds_from_trait: \
-                matching_bound={}",
-               matching_bound.repr());
+                matching_bound={:?}",
+               matching_bound);
         match matching_bound {
             None => false,
             Some(bound) => {
@@ -1090,8 +1089,8 @@ fn assemble_candidates_from_caller_bounds<'o>(&mut self,
                                                   candidates: &mut SelectionCandidateSet<'tcx>)
                                                   -> Result<(),SelectionError<'tcx>>
     {
-        debug!("assemble_candidates_from_caller_bounds({})",
-               stack.obligation.repr());
+        debug!("assemble_candidates_from_caller_bounds({:?})",
+               stack.obligation);
 
         let all_bounds =
             self.param_env().caller_bounds
@@ -1157,10 +1156,10 @@ fn assemble_closure_candidates(&mut self,
             _ => { return Ok(()); }
         };
 
-        debug!("assemble_unboxed_candidates: self_ty={} kind={:?} obligation={}",
-               self_ty.repr(),
+        debug!("assemble_unboxed_candidates: self_ty={:?} kind={:?} obligation={:?}",
+               self_ty,
                kind,
-               obligation.repr());
+               obligation);
 
         match self.closure_typer.closure_kind(closure_def_id) {
             Some(closure_kind) => {
@@ -1223,7 +1222,7 @@ fn assemble_candidates_from_impls(&mut self,
                                       candidates: &mut SelectionCandidateSet<'tcx>)
                                       -> Result<(), SelectionError<'tcx>>
     {
-        debug!("assemble_candidates_from_impls(obligation={})", obligation.repr());
+        debug!("assemble_candidates_from_impls(obligation={:?})", obligation);
 
         let def = ty::lookup_trait_def(self.tcx(), obligation.predicate.def_id());
 
@@ -1249,7 +1248,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());
+        debug!("assemble_candidates_from_default_impls(self_ty={:?})", self_ty);
 
         let def_id = obligation.predicate.def_id();
 
@@ -1318,8 +1317,8 @@ fn assemble_candidates_from_object_ty(&mut self,
                                           obligation: &TraitObligation<'tcx>,
                                           candidates: &mut SelectionCandidateSet<'tcx>)
     {
-        debug!("assemble_candidates_from_object_ty(self_ty={})",
-               self.infcx.shallow_resolve(*obligation.self_ty().skip_binder()).repr());
+        debug!("assemble_candidates_from_object_ty(self_ty={:?})",
+               self.infcx.shallow_resolve(*obligation.self_ty().skip_binder()));
 
         // Object-safety candidates are only applicable to object-safe
         // traits. Including this check is useful because it helps
@@ -1364,8 +1363,8 @@ fn assemble_candidates_from_object_ty(&mut self,
                 }
             };
 
-            debug!("assemble_candidates_from_object_ty: poly_trait_ref={}",
-                   poly_trait_ref.repr());
+            debug!("assemble_candidates_from_object_ty: poly_trait_ref={:?}",
+                   poly_trait_ref);
 
             // 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);
@@ -1408,8 +1407,8 @@ fn assemble_candidates_for_unsizing(&mut self,
         let source = self.infcx.shallow_resolve(self_ty);
         let target = self.infcx.shallow_resolve(obligation.predicate.0.input_types()[0]);
 
-        debug!("assemble_candidates_for_unsizing(source={}, target={})",
-               source.repr(), target.repr());
+        debug!("assemble_candidates_for_unsizing(source={:?}, target={:?})",
+               source, target);
 
         let may_apply = match (&source.sty, &target.sty) {
             // Trait+Kx+'a -> Trait+Ky+'b (upcasts).
@@ -1475,7 +1474,7 @@ fn winnow_candidate<'o>(&mut self,
                             candidate: &SelectionCandidate<'tcx>)
                             -> EvaluationResult<'tcx>
     {
-        debug!("winnow_candidate: candidate={}", candidate.repr());
+        debug!("winnow_candidate: candidate={:?}", candidate);
         let result = self.infcx.probe(|_| {
             let candidate = (*candidate).clone();
             match self.confirm_candidate(stack.obligation, candidate) {
@@ -1567,8 +1566,8 @@ fn assemble_builtin_bound_candidates<'o>(&mut self,
     {
         match self.builtin_bound(bound, stack.obligation) {
             Ok(If(..)) => {
-                debug!("builtin_bound: bound={}",
-                       bound.repr());
+                debug!("builtin_bound: bound={:?}",
+                       bound);
                 candidates.vec.push(BuiltinCandidate(bound));
                 Ok(())
             }
@@ -1776,8 +1775,8 @@ fn builtin_bound(&mut self,
             | ty::TyInfer(ty::FreshFloatTy(_)) => {
                 self.tcx().sess.bug(
                     &format!(
-                        "asked to assemble builtin bounds of unexpected type: {}",
-                        self_ty.repr()));
+                        "asked to assemble builtin bounds of unexpected type: {:?}",
+                        self_ty));
             }
         };
 
@@ -1839,8 +1838,8 @@ fn constituent_types_for_ty(&self, t: Ty<'tcx>) -> Option<Vec<Ty<'tcx>>> {
             ty::TyInfer(ty::FreshFloatTy(_)) => {
                 self.tcx().sess.bug(
                     &format!(
-                        "asked to assemble constituent types of unexpected type: {}",
-                        t.repr()));
+                        "asked to assemble constituent types of unexpected type: {:?}",
+                        t));
             }
 
             ty::TyBox(referent_ty) => {  // Box<T>
@@ -1974,9 +1973,9 @@ fn confirm_candidate(&mut self,
                          candidate: SelectionCandidate<'tcx>)
                          -> Result<Selection<'tcx>,SelectionError<'tcx>>
     {
-        debug!("confirm_candidate({}, {})",
-               obligation.repr(),
-               candidate.repr());
+        debug!("confirm_candidate({:?}, {:?})",
+               obligation,
+               candidate);
 
         match candidate {
             BuiltinCandidate(builtin_bound) => {
@@ -2066,9 +2065,9 @@ fn confirm_param_candidate(&mut self,
                                param: ty::PolyTraitRef<'tcx>)
                                -> Vec<PredicateObligation<'tcx>>
     {
-        debug!("confirm_param_candidate({},{})",
-               obligation.repr(),
-               param.repr());
+        debug!("confirm_param_candidate({:?},{:?})",
+               obligation,
+               param);
 
         // During evaluation, we already checked that this
         // where-clause trait-ref could be unified with the obligation
@@ -2078,9 +2077,9 @@ fn confirm_param_candidate(&mut self,
             Ok(obligations) => obligations,
             Err(()) => {
                 self.tcx().sess.bug(
-                    &format!("Where clause `{}` was applicable to `{}` but now is not",
-                             param.repr(),
-                             obligation.repr()));
+                    &format!("Where clause `{:?}` was applicable to `{:?}` but now is not",
+                             param,
+                             obligation));
             }
         }
     }
@@ -2091,16 +2090,16 @@ fn confirm_builtin_candidate(&mut self,
                                  -> Result<VtableBuiltinData<PredicateObligation<'tcx>>,
                                            SelectionError<'tcx>>
     {
-        debug!("confirm_builtin_candidate({})",
-               obligation.repr());
+        debug!("confirm_builtin_candidate({:?})",
+               obligation);
 
         match try!(self.builtin_bound(bound, obligation)) {
             If(nested) => Ok(self.vtable_builtin_data(obligation, bound, nested)),
             AmbiguousBuiltin | ParameterBuiltin => {
                 self.tcx().sess.span_bug(
                     obligation.cause.span,
-                    &format!("builtin bound for {} was ambig",
-                            obligation.repr()));
+                    &format!("builtin bound for {:?} was ambig",
+                            obligation));
             }
         }
     }
@@ -2120,8 +2119,8 @@ fn vtable_builtin_data(&mut self,
 
         let obligations = self.collect_predicates_for_types(obligation, trait_def, nested);
 
-        debug!("vtable_builtin_data: obligations={}",
-               obligations.repr());
+        debug!("vtable_builtin_data: obligations={:?}",
+               obligations);
 
         VtableBuiltinData { nested: obligations }
     }
@@ -2136,9 +2135,9 @@ fn confirm_default_impl_candidate(&mut self,
                                       trait_def_id: ast::DefId)
                                       -> VtableDefaultImplData<PredicateObligation<'tcx>>
     {
-        debug!("confirm_default_impl_candidate({}, {})",
-               obligation.repr(),
-               trait_def_id.repr());
+        debug!("confirm_default_impl_candidate({:?}, {:?})",
+               obligation,
+               trait_def_id);
 
         // binder is moved below
         let self_ty = self.infcx.shallow_resolve(obligation.predicate.skip_binder().self_ty());
@@ -2147,8 +2146,8 @@ fn confirm_default_impl_candidate(&mut self,
             None => {
                 self.tcx().sess.bug(
                     &format!(
-                        "asked to confirm default implementation for ambiguous type: {}",
-                        self_ty.repr()));
+                        "asked to confirm default implementation for ambiguous type: {:?}",
+                        self_ty));
             }
         }
     }
@@ -2158,9 +2157,9 @@ fn confirm_default_impl_object_candidate(&mut self,
                                              trait_def_id: ast::DefId)
                                              -> VtableDefaultImplData<PredicateObligation<'tcx>>
     {
-        debug!("confirm_default_impl_object_candidate({}, {})",
-               obligation.repr(),
-               trait_def_id.repr());
+        debug!("confirm_default_impl_object_candidate({:?}, {:?})",
+               obligation,
+               trait_def_id);
 
         assert!(ty::has_attr(self.tcx(), trait_def_id, "rustc_reflect_like"));
 
@@ -2186,8 +2185,8 @@ 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()));
+                        "asked to confirm default object implementation for non-object type: {:?}",
+                        self_ty));
             }
         }
     }
@@ -2199,7 +2198,7 @@ fn vtable_default_impl(&mut self,
                            nested: ty::Binder<Vec<Ty<'tcx>>>)
                            -> VtableDefaultImplData<PredicateObligation<'tcx>>
     {
-        debug!("vtable_default_impl_data: nested={}", nested.repr());
+        debug!("vtable_default_impl_data: nested={:?}", nested);
 
         let mut obligations = self.collect_predicates_for_types(obligation,
                                                                 trait_def_id,
@@ -2220,7 +2219,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());
+        debug!("vtable_default_impl_data: obligations={:?}", obligations);
 
         VtableDefaultImplData {
             trait_def_id: trait_def_id,
@@ -2234,9 +2233,9 @@ fn confirm_impl_candidate(&mut self,
                               -> Result<VtableImplData<'tcx, PredicateObligation<'tcx>>,
                                         SelectionError<'tcx>>
     {
-        debug!("confirm_impl_candidate({},{})",
-               obligation.repr(),
-               impl_def_id.repr());
+        debug!("confirm_impl_candidate({:?},{:?})",
+               obligation,
+               impl_def_id);
 
         // First, create the substitutions by matching the impl again,
         // this time not in a probe.
@@ -2244,7 +2243,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());
+            debug!("confirm_impl_candidate substs={:?}", substs);
             Ok(self.vtable_impl(impl_def_id, substs, obligation.cause.clone(),
                                 obligation.recursion_depth + 1, skol_map, snapshot))
         })
@@ -2259,11 +2258,11 @@ fn vtable_impl(&mut self,
                    snapshot: &infer::CombinedSnapshot)
                    -> VtableImplData<'tcx, PredicateObligation<'tcx>>
     {
-        debug!("vtable_impl(impl_def_id={}, substs={}, recursion_depth={}, skol_map={})",
-               impl_def_id.repr(),
-               substs.repr(),
+        debug!("vtable_impl(impl_def_id={:?}, substs={:?}, recursion_depth={}, skol_map={:?})",
+               impl_def_id,
+               substs,
                recursion_depth,
-               skol_map.repr());
+               skol_map);
 
         let mut impl_obligations =
             self.impl_or_trait_obligations(cause,
@@ -2273,9 +2272,9 @@ fn vtable_impl(&mut self,
                                            skol_map,
                                            snapshot);
 
-        debug!("vtable_impl: impl_def_id={} impl_obligations={}",
-               impl_def_id.repr(),
-               impl_obligations.repr());
+        debug!("vtable_impl: impl_def_id={:?} impl_obligations={:?}",
+               impl_def_id,
+               impl_obligations);
 
         impl_obligations.append(&mut substs.obligations);
 
@@ -2288,8 +2287,8 @@ fn confirm_object_candidate(&mut self,
                                 obligation: &TraitObligation<'tcx>)
                                 -> VtableObjectData<'tcx>
     {
-        debug!("confirm_object_candidate({})",
-               obligation.repr());
+        debug!("confirm_object_candidate({:?})",
+               obligation);
 
         // FIXME skipping binder here seems wrong -- we should
         // probably flatten the binder from the obligation and the
@@ -2330,8 +2329,8 @@ fn confirm_fn_pointer_candidate(&mut self,
                                     obligation: &TraitObligation<'tcx>)
                                     -> Result<ty::Ty<'tcx>,SelectionError<'tcx>>
     {
-        debug!("confirm_fn_pointer_candidate({})",
-               obligation.repr());
+        debug!("confirm_fn_pointer_candidate({:?})",
+               obligation);
 
         // ok to skip binder; it is reintroduced below
         let self_ty = self.infcx.shallow_resolve(*obligation.self_ty().skip_binder());
@@ -2357,20 +2356,20 @@ fn confirm_closure_candidate(&mut self,
                                  -> Result<VtableClosureData<'tcx, PredicateObligation<'tcx>>,
                                            SelectionError<'tcx>>
     {
-        debug!("confirm_closure_candidate({},{},{})",
-               obligation.repr(),
-               closure_def_id.repr(),
-               substs.repr());
+        debug!("confirm_closure_candidate({:?},{:?},{:?})",
+               obligation,
+               closure_def_id,
+               substs);
 
         let Normalized {
             value: trait_ref,
             obligations
         } = self.closure_trait_ref(obligation, closure_def_id, substs);
 
-        debug!("confirm_closure_candidate(closure_def_id={}, trait_ref={}, obligations={})",
-               closure_def_id.repr(),
-               trait_ref.repr(),
-               obligations.repr());
+        debug!("confirm_closure_candidate(closure_def_id={:?}, trait_ref={:?}, obligations={:?})",
+               closure_def_id,
+               trait_ref,
+               obligations);
 
         try!(self.confirm_poly_trait_refs(obligation.cause.clone(),
                                           obligation.predicate.to_poly_trait_ref(),
@@ -2438,8 +2437,8 @@ fn confirm_builtin_unsize_candidate(&mut self,
             ty::no_late_bound_regions(tcx, &obligation.self_ty()).unwrap());
         let target = self.infcx.shallow_resolve(obligation.predicate.0.input_types()[0]);
 
-        debug!("confirm_builtin_unsize_candidate(source={}, target={})",
-               source.repr(), target.repr());
+        debug!("confirm_builtin_unsize_candidate(source={:?}, target={:?})",
+               source, target);
 
         let mut nested = vec![];
         match (&source.sty, &target.sty) {
@@ -2615,9 +2614,9 @@ fn rematch_impl(&mut self,
             Ok((substs, skol_map)) => (substs, skol_map),
             Err(()) => {
                 self.tcx().sess.bug(
-                    &format!("Impl {} was matchable against {} but now is not",
-                            impl_def_id.repr(),
-                            obligation.repr()));
+                    &format!("Impl {:?} was matchable against {:?} but now is not",
+                            impl_def_id,
+                            obligation));
             }
         }
     }
@@ -2656,12 +2655,12 @@ fn match_impl(&mut self,
                                           obligation.recursion_depth + 1,
                                           &impl_trait_ref);
 
-        debug!("match_impl(impl_def_id={}, obligation={}, \
-               impl_trait_ref={}, skol_obligation_trait_ref={})",
-               impl_def_id.repr(),
-               obligation.repr(),
-               impl_trait_ref.repr(),
-               skol_obligation_trait_ref.repr());
+        debug!("match_impl(impl_def_id={:?}, obligation={:?}, \
+               impl_trait_ref={:?}, skol_obligation_trait_ref={:?})",
+               impl_def_id,
+               obligation,
+               impl_trait_ref,
+               skol_obligation_trait_ref);
 
         let origin = infer::RelateOutputImplTypes(obligation.cause.span);
         if let Err(e) = self.infcx.sub_trait_refs(false,
@@ -2677,7 +2676,7 @@ fn match_impl(&mut self,
             return Err(());
         }
 
-        debug!("match_impl: success impl_substs={}", impl_substs.repr());
+        debug!("match_impl: success impl_substs={:?}", impl_substs);
         Ok((Normalized {
             value: impl_substs,
             obligations: impl_trait_ref.obligations
@@ -2728,9 +2727,9 @@ fn match_poly_trait_ref(&mut self,
                             poly_trait_ref: ty::PolyTraitRef<'tcx>)
                             -> Result<(),()>
     {
-        debug!("match_poly_trait_ref: obligation={} poly_trait_ref={}",
-               obligation.repr(),
-               poly_trait_ref.repr());
+        debug!("match_poly_trait_ref: obligation={:?} poly_trait_ref={:?}",
+               obligation,
+               poly_trait_ref);
 
         let origin = infer::RelateOutputImplTypes(obligation.cause.span);
         match self.infcx.sub_poly_trait_refs(false,
@@ -2769,15 +2768,15 @@ fn match_inherent_impl(&mut self,
         let impl_self_ty = ty::lookup_item_type(self.tcx(), impl_def_id).ty;
         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(),
-               impl_self_ty.repr());
+        debug!("match_impl_self_types(obligation_self_ty={:?}, impl_self_ty={:?})",
+               obligation_self_ty,
+               impl_self_ty);
 
         match self.match_self_types(obligation_cause,
                                     impl_self_ty,
                                     obligation_self_ty) {
             Ok(()) => {
-                debug!("Matched impl_substs={}", impl_substs.repr());
+                debug!("Matched impl_substs={:?}", impl_substs);
                 Ok(impl_substs)
             }
             Err(()) => {
@@ -2889,7 +2888,7 @@ fn impl_or_trait_obligations(&mut self,
                                  snapshot: &infer::CombinedSnapshot)
                                  -> Vec<PredicateObligation<'tcx>>
     {
-        debug!("impl_or_trait_obligations(def_id={})", def_id.repr());
+        debug!("impl_or_trait_obligations(def_id={:?})", def_id);
 
         let predicates = ty::lookup_predicates(self.tcx(), def_id);
         let predicates = predicates.instantiate(self.tcx(), substs);
@@ -2939,9 +2938,9 @@ fn derived_cause(&self,
     fn upcast(&mut self, obj_trait_ref: ty::PolyTraitRef<'tcx>, obligation: &TraitObligation<'tcx>)
               -> Vec<ty::PolyTraitRef<'tcx>>
     {
-        debug!("upcast(obj_trait_ref={}, obligation={})",
-               obj_trait_ref.repr(),
-               obligation.repr());
+        debug!("upcast(obj_trait_ref={:?}, obligation={:?})",
+               obj_trait_ref,
+               obligation);
 
         let obligation_def_id = obligation.predicate.def_id();
         let mut upcast_trait_refs = util::upcast(self.tcx(), obj_trait_ref, obligation_def_id);
@@ -2957,7 +2956,7 @@ 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());
+        debug!("upcast: upcast_trait_refs={:?}", upcast_trait_refs);
         upcast_trait_refs
     }
 }
index 2c6feb66fa8ca72e683fc920d88697d6e9b80298..6fb085c8838d7bba4dede0df9c96ef0dd86f4d90 100644 (file)
@@ -16,7 +16,6 @@
 use syntax::codemap::Span;
 use util::common::ErrorReported;
 use util::nodemap::FnvHashSet;
-use util::ppaux::Repr;
 
 use super::{Obligation, ObligationCause, PredicateObligation,
             VtableImpl, VtableParam, VtableImplData, VtableDefaultImplData};
@@ -125,8 +124,8 @@ fn push(&mut self, predicate: &ty::Predicate<'tcx>) {
                               .map(|p| p.subst_supertrait(self.tcx, &data.to_poly_trait_ref()))
                               .collect();
 
-                debug!("super_predicates: data={} predicates={}",
-                       data.repr(), predicates.repr());
+                debug!("super_predicates: data={:?} predicates={:?}",
+                       data, predicates);
 
                 // Only keep those bounds that we haven't already
                 // seen.  This is necessary to prevent infinite
@@ -314,8 +313,8 @@ pub fn predicates_for_generics<'tcx>(cause: ObligationCause<'tcx>,
                                      generic_bounds: &ty::InstantiatedPredicates<'tcx>)
                                      -> Vec<PredicateObligation<'tcx>>
 {
-    debug!("predicates_for_generics(generic_bounds={})",
-           generic_bounds.repr());
+    debug!("predicates_for_generics(generic_bounds={:?})",
+           generic_bounds);
 
     generic_bounds.predicates.iter().map(|predicate| {
         Obligation { cause: cause.clone(),
index 1274b3498fd3377bfaed838888dfea96e80e871e..e82754680a5e967fc633a37ccdf29fe2217fbc16 100644 (file)
@@ -66,7 +66,6 @@
 use middle::ty;
 use middle::ty_fold::{self, TypeFoldable, TypeFolder};
 use middle::ty_walk::{self, TypeWalker};
-use util::ppaux::{Repr, UserString};
 use util::common::{memoized, ErrorReported};
 use util::nodemap::{NodeMap, NodeSet, DefIdMap, DefIdSet};
 use util::nodemap::FnvHashMap;
@@ -2848,8 +2847,8 @@ pub fn record_impl(&self,
                        tcx: &ctxt<'tcx>,
                        impl_def_id: DefId,
                        impl_trait_ref: TraitRef<'tcx>) {
-        debug!("TraitDef::record_impl for {}, from {}",
-               self.repr(), impl_trait_ref.repr());
+        debug!("TraitDef::record_impl for {:?}, from {:?}",
+               self, impl_trait_ref);
 
         // 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.
@@ -3773,7 +3772,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())),
+                                  ty)),
     }
 }
 
@@ -4242,8 +4241,8 @@ 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(),
+    debug!("type_impls_bound({:?}, {:?}) = {:?}",
+           ty,
            bound,
            is_impld);
 
@@ -4344,20 +4343,20 @@ pub fn is_ffi_safe<'tcx>(cx: &ctxt<'tcx>, ty: Ty<'tcx>) -> bool {
 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(), ty.repr());
+        debug!("type_requires({:?}, {:?})?",
+               r_ty, ty);
 
         let r = r_ty == ty || subtypes_require(cx, seen, r_ty, ty);
 
-        debug!("type_requires({}, {})? {:?}",
-               r_ty.repr(), ty.repr(), r);
+        debug!("type_requires({:?}, {:?})? {:?}",
+               r_ty, ty, 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(), ty.repr());
+        debug!("subtypes_require({:?}, {:?})?",
+               r_ty, ty);
 
         let r = match ty.sty {
             // fixed length vectors need special treatment compared to
@@ -4435,8 +4434,8 @@ fn subtypes_require<'tcx>(cx: &ctxt<'tcx>, seen: &mut Vec<DefId>,
             }
         };
 
-        debug!("subtypes_require({}, {})? {:?}",
-               r_ty.repr(), ty.repr(), r);
+        debug!("subtypes_require({:?}, {:?})? {:?}",
+               r_ty, ty, r);
 
         return r;
     }
@@ -4542,7 +4541,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());
+        debug!("is_type_structurally_recursive: {:?}", ty);
 
         match ty.sty {
             TyStruct(did, _) | TyEnum(did, _) => {
@@ -4561,9 +4560,9 @@ fn is_type_structurally_recursive<'tcx>(cx: &ctxt<'tcx>, sp: Span,
                     match iter.next() {
                         Some(&seen_type) => {
                             if same_struct_or_enum_def_id(seen_type, did) {
-                                debug!("SelfRecursive: {} contains {}",
-                                       seen_type.repr(),
-                                       ty.repr());
+                                debug!("SelfRecursive: {:?} contains {:?}",
+                                       seen_type,
+                                       ty);
                                 return SelfRecursive;
                             }
                         }
@@ -4581,9 +4580,9 @@ 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(),
-                                   ty.repr());
+                            debug!("ContainsRecursive: {:?} contains {:?}",
+                                   seen_type,
+                                   ty);
                             return ContainsRecursive;
                         }
                     }
@@ -4603,14 +4602,14 @@ fn is_type_structurally_recursive<'tcx>(cx: &ctxt<'tcx>, sp: Span,
         }
     }
 
-    debug!("is_type_representable: {}", ty.repr());
+    debug!("is_type_representable: {:?}", ty);
 
     // 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(), r);
+    debug!("is_type_representable: {:?} is {:?}", ty, r);
     r
 }
 
@@ -5012,7 +5011,7 @@ pub fn adjust_ty<'tcx, F>(cx: &ctxt<'tcx>,
                         _ => {
                             cx.sess.bug(
                                 &format!("AdjustReifyFnPointer adjustment on non-fn-item: \
-                                          {}", unadjusted_ty.repr()));
+                                          {:?}", unadjusted_ty));
                         }
                     }
                 }
@@ -5053,7 +5052,7 @@ pub fn adjust_ty<'tcx, F>(cx: &ctxt<'tcx>,
                                         span,
                                         &format!("the {}th autoderef failed: {}",
                                                 i,
-                                                 adjusted_ty.user_string())
+                                                 adjusted_ty)
                                         );
                                 }
                             }
@@ -5298,8 +5297,8 @@ pub fn impl_or_trait_item_idx(id: ast::Name, trait_items: &[ImplOrTraitItem])
 pub fn ty_sort_string(cx: &ctxt, ty: Ty) -> String {
     match ty.sty {
         TyBool | TyChar | TyInt(_) |
-        TyUint(_) | TyFloat(_) | TyStr => ty.user_string(),
-        TyTuple(ref tys) if tys.is_empty() => ty.user_string(),
+        TyUint(_) | TyFloat(_) | TyStr => ty.to_string(),
+        TyTuple(ref tys) if tys.is_empty() => ty.to_string(),
 
         TyEnum(id, _) => format!("enum `{}`", item_path_str(cx, id)),
         TyBox(_) => "box".to_string(),
@@ -6067,7 +6066,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();
+    let repr_type = repr_type.to_ty(cx);
     span_err!(cx.sess, variant_span, E0370,
               "enum discriminant overflowed on value after {}: {}; \
                set explicitly via {} = {} if that is desired outcome",
@@ -6560,8 +6559,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(),
-           predicates.repr());
+           erased_self_ty,
+           predicates);
 
     assert!(!erased_self_ty.has_escaping_regions());
 
@@ -6679,7 +6678,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());
+    debug!("populate_implementations_for_trait_if_necessary: searching for {:?}", def);
 
     if csearch::is_defaulted_trait(&tcx.sess.cstore, trait_id) {
         record_trait_has_default_impl(tcx, trait_id);
@@ -6988,7 +6987,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());
+                   def);
             let ty = ty::mk_param_from_def(tcx, def);
             types.push(def.space, ty);
        }
@@ -7021,8 +7020,8 @@ pub fn construct_parameter_environment<'a,'tcx>(
 
     debug!("construct_parameter_environment: free_id={:?} free_subst={:?} predicates={:?}",
            free_id,
-           free_substs.repr(),
-           predicates.repr());
+           free_substs,
+           predicates);
 
     //
     // Finally, we have to normalize the bounds in the environment, in
index adc282bc2fdd548bc70e6dc7c0d2f35edfef2fed..63c46032479a4f775bd3fbcb088a868a700aef8e 100644 (file)
@@ -45,7 +45,6 @@
 use syntax::ast;
 use syntax::owned_slice::OwnedSlice;
 use util::nodemap::FnvHashMap;
-use util::ppaux::Repr;
 
 ///////////////////////////////////////////////////////////////////////////
 // Two generic traits
@@ -844,13 +843,13 @@ fn exit_region_binder(&mut self) {
     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.current_depth);
+                debug!("RegionFolder.fold_region({:?}) skipped bound region (current depth={})",
+                       r, self.current_depth);
                 r
             }
             _ => {
-                debug!("RegionFolder.fold_region({}) folding free region (current_depth={})",
-                       r.repr(), self.current_depth);
+                debug!("RegionFolder.fold_region({:?}) folding free region (current_depth={})",
+                       r, self.current_depth);
                 (self.fld_r)(r, self.current_depth)
             }
         }
@@ -889,7 +888,7 @@ pub fn replace_late_bound_regions<'tcx,T,F>(tcx: &ty::ctxt<'tcx>,
     where F : FnMut(ty::BoundRegion) -> ty::Region,
           T : TypeFoldable<'tcx>,
 {
-    debug!("replace_late_bound_regions({})", value.repr());
+    debug!("replace_late_bound_regions({:?})", value);
     let mut replacer = RegionReplacer::new(tcx, &mut f);
     let result = value.skip_binder().fold_with(&mut replacer);
     (result, replacer.map)
@@ -918,8 +917,8 @@ fn fold_ty(&mut self, t: Ty<'tcx>) -> Ty<'tcx> {
     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.current_depth);
+                debug!("RegionReplacer.fold_region({:?}) folding region (current_depth={})",
+                       r, 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 {
@@ -998,8 +997,8 @@ pub fn shift_region(region: ty::Region, amount: u32) -> ty::Region {
 
 pub fn shift_regions<'tcx, T:TypeFoldable<'tcx>>(tcx: &ty::ctxt<'tcx>,
                                                  amount: u32, value: &T) -> T {
-    debug!("shift_regions(value={}, amount={})",
-           value.repr(), amount);
+    debug!("shift_regions(value={:?}, amount={})",
+           value, amount);
 
     value.fold_with(&mut RegionFolder::new(tcx, &mut |region, _current_depth| {
         shift_region(region, amount)
index 3c9777935706f75714410bd8b922391aa1c02b33..135118820a771fae4eada9a2be38175051916c9a 100644 (file)
@@ -10,7 +10,6 @@
 
 use middle::ty::{self, Ty};
 use middle::ty_relate::{self, Relate, TypeRelation, RelateResult};
-use util::ppaux::Repr;
 
 /// A type "A" *matches* "B" if the fresh types in B could be
 /// substituted with values so as to make it equal to A. Matching is
@@ -53,16 +52,16 @@ 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({}, {})",
+        debug!("{}.regions({:?}, {:?})",
                self.tag(),
-               a.repr(),
-               b.repr());
+               a,
+               b);
         Ok(a)
     }
 
     fn tys(&mut self, a: Ty<'tcx>, b: Ty<'tcx>) -> RelateResult<'tcx, Ty<'tcx>> {
-        debug!("{}.tys({}, {})", self.tag(),
-               a.repr(), b.repr());
+        debug!("{}.tys({:?}, {:?})", self.tag(),
+               a, b);
         if a == b { return Ok(a); }
 
         match (&a.sty, &b.sty) {
index e9c84f4c9ce2ae5da8b587f5385326e3b79f733b..b8c212fe3f20b1a33296890628c93c0dd895b5ed 100644 (file)
@@ -19,7 +19,6 @@
 use std::rc::Rc;
 use syntax::abi;
 use syntax::ast;
-use util::ppaux::Repr;
 
 pub type RelateResult<'tcx, T> = Result<T, ty::type_err<'tcx>>;
 
@@ -79,10 +78,10 @@ fn relate<R>(relation: &mut R,
                  -> RelateResult<'tcx, ty::mt<'tcx>>
         where R: TypeRelation<'a,'tcx>
     {
-        debug!("{}.mts({}, {})",
+        debug!("{}.mts({:?}, {:?})",
                relation.tag(),
-               a.repr(),
-               b.repr());
+               a,
+               b);
         if a.mutbl != b.mutbl {
             Err(ty::terr_mutability)
         } else {
@@ -107,10 +106,10 @@ fn relate_item_substs<'a,'tcx:'a,R>(relation: &mut R,
                                     -> RelateResult<'tcx, Substs<'tcx>>
     where R: TypeRelation<'a,'tcx>
 {
-    debug!("substs: item_def_id={} a_subst={} b_subst={}",
-           item_def_id.repr(),
-           a_subst.repr(),
-           b_subst.repr());
+    debug!("substs: item_def_id={:?} a_subst={:?} b_subst={:?}",
+           item_def_id,
+           a_subst,
+           b_subst);
 
     let variances;
     let opt_variances = if relation.tcx().variance_computed.get() {
@@ -193,11 +192,11 @@ fn relate_region_params<'a,'tcx:'a,R>(relation: &mut R,
 {
     let num_region_params = a_rs.len();
 
-    debug!("relate_region_params(a_rs={}, \
-            b_rs={}, variances={})",
-           a_rs.repr(),
-           b_rs.repr(),
-           variances.repr());
+    debug!("relate_region_params(a_rs={:?}, \
+            b_rs={:?}, variances={:?})",
+           a_rs,
+           b_rs,
+           variances);
 
     assert_eq!(num_region_params,
                variances.map_or(num_region_params,
index 5d524c51b5eb3470fd96ef7347876e78d38077c1..485d856ac2508a914e3c2e65e5c2621a71c0d07c 100644 (file)
 use syntax::parse::token;
 use syntax::{ast, ast_util};
 
-/// Produces a string suitable for debugging output.
-pub trait Repr {
-    fn repr(&self) -> String;
-}
-
-/// Produces a string suitable for showing to the user.
-pub trait UserString {
-    fn user_string(&self) -> String;
-}
-
-impl<T: fmt::Debug> Repr for T {
-    fn repr(&self) -> String {
-        format!("{:?}", *self)
-    }
-}
-
-impl<T: fmt::Display> UserString for T {
-    fn user_string(&self) -> String {
-        format!("{}", *self)
-    }
-}
-
 pub fn verbose() -> bool {
     ty::tls::with(|tcx| tcx.sess.verbose())
 }
@@ -146,7 +124,7 @@ fn parameterized<GG>(f: &mut fmt::Formatter,
         subst::NonerasedRegions(ref regions) => {
             for &r in regions {
                 try!(start_or_continue(f, "<", ", "));
-                let s = r.user_string();
+                let s = r.to_string();
                 if s.is_empty() {
                     // This happens when the value of the region
                     // parameter is not easily serialized. This may be
@@ -316,7 +294,7 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         // Region, if not obviously implied by builtin bounds.
         if bounds.region_bound != ty::ReStatic {
             // Region bound is implied by builtin bounds:
-            let bound = bounds.region_bound.user_string();
+            let bound = bounds.region_bound.to_string();
             if !bound.is_empty() {
                 try!(write!(f, " + {}", bound));
             }
@@ -589,7 +567,7 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
             }
         };
 
-        let region_str = self.region_bound.repr();
+        let region_str = format!("{:?}", self.region_bound);
         if !region_str.is_empty() {
             try!(maybe_continue(f));
             try!(write!(f, "{}", region_str));
@@ -693,7 +671,7 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
             }
             TyRef(r, ref tm) => {
                 try!(write!(f, "&"));
-                let s = r.user_string();
+                let s = r.to_string();
                 try!(write!(f, "{}", s));
                 if !s.is_empty() {
                     try!(write!(f, " "));
index b15586cc2b455f5f196b1b4c6230f7fca68ed2b9..49933441cf01ec4b1b76160e9ded6c7842b4d812 100644 (file)
@@ -24,7 +24,6 @@
 use rustc::middle::mem_categorization as mc;
 use rustc::middle::region;
 use rustc::middle::ty;
-use rustc::util::ppaux::Repr;
 use syntax::ast;
 use syntax::codemap::Span;
 
@@ -97,8 +96,8 @@ fn consume(&mut self,
                consume_span: Span,
                cmt: mc::cmt<'tcx>,
                mode: euv::ConsumeMode) {
-        debug!("consume(consume_id={}, cmt={}, mode={:?})",
-               consume_id, cmt.repr(), mode);
+        debug!("consume(consume_id={}, cmt={:?}, mode={:?})",
+               consume_id, cmt, mode);
 
         self.consume_common(consume_id, consume_span, cmt, mode);
     }
@@ -112,9 +111,9 @@ fn consume_pat(&mut self,
                    consume_pat: &ast::Pat,
                    cmt: mc::cmt<'tcx>,
                    mode: euv::ConsumeMode) {
-        debug!("consume_pat(consume_pat={}, cmt={}, mode={:?})",
-               consume_pat.repr(),
-               cmt.repr(),
+        debug!("consume_pat(consume_pat={:?}, cmt={:?}, mode={:?})",
+               consume_pat,
+               cmt,
                mode);
 
         self.consume_common(consume_pat.id, consume_pat.span, cmt, mode);
@@ -128,9 +127,9 @@ fn borrow(&mut self,
               bk: ty::BorrowKind,
               loan_cause: euv::LoanCause)
     {
-        debug!("borrow(borrow_id={}, cmt={}, loan_region={:?}, \
+        debug!("borrow(borrow_id={}, cmt={:?}, loan_region={:?}, \
                bk={:?}, loan_cause={:?})",
-               borrow_id, cmt.repr(), loan_region,
+               borrow_id, cmt, loan_region,
                bk, loan_cause);
 
         match opt_loan_path(&cmt) {
@@ -153,8 +152,8 @@ fn mutate(&mut self,
               assignee_cmt: mc::cmt<'tcx>,
               mode: euv::MutateMode)
     {
-        debug!("mutate(assignment_id={}, assignee_cmt={})",
-               assignment_id, assignee_cmt.repr());
+        debug!("mutate(assignment_id={}, assignee_cmt={:?})",
+               assignment_id, assignee_cmt);
 
         match opt_loan_path(&assignee_cmt) {
             Some(lp) => {
@@ -384,9 +383,9 @@ pub fn report_error_if_loans_conflict(&self,
         //! Checks whether `old_loan` and `new_loan` can safely be issued
         //! simultaneously.
 
-        debug!("report_error_if_loans_conflict(old_loan={}, new_loan={})",
-               old_loan.repr(),
-               new_loan.repr());
+        debug!("report_error_if_loans_conflict(old_loan={:?}, new_loan={:?})",
+               old_loan,
+               new_loan);
 
         // 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,
@@ -408,9 +407,9 @@ pub fn report_error_if_loan_conflicts_with_restriction(&self,
         //! prohibit `loan2`. Returns false if an error is reported.
 
         debug!("report_error_if_loan_conflicts_with_restriction(\
-                loan1={}, loan2={})",
-               loan1.repr(),
-               loan2.repr());
+                loan1={:?}, loan2={:?})",
+               loan1,
+               loan2);
 
         if compatible_borrow_kinds(loan1.kind, loan2.kind) {
             return true;
@@ -672,9 +671,9 @@ pub fn analyze_restrictions_on_use(&self,
                                        use_path: &LoanPath<'tcx>,
                                        borrow_kind: ty::BorrowKind)
                                        -> UseError<'tcx> {
-        debug!("analyze_restrictions_on_use(expr_id={}, use_path={})",
+        debug!("analyze_restrictions_on_use(expr_id={}, use_path={:?})",
                self.tcx().map.node_to_string(expr_id),
-               use_path.repr());
+               use_path);
 
         let mut ret = UseOk;
 
@@ -698,8 +697,8 @@ fn check_if_path_is_moved(&self,
                               span: Span,
                               use_kind: MovedValueUseKind,
                               lp: &Rc<LoanPath<'tcx>>) {
-        debug!("check_if_path_is_moved(id={}, use_kind={:?}, lp={})",
-               id, use_kind, lp.repr());
+        debug!("check_if_path_is_moved(id={}, use_kind={:?}, lp={:?})",
+               id, use_kind, lp);
 
         // FIXME (22079): if you find yourself tempted to cut and paste
         // the body below and then specializing the error reporting,
@@ -792,7 +791,7 @@ fn check_assignment(&self,
                         assignment_span: Span,
                         assignee_cmt: mc::cmt<'tcx>,
                         mode: euv::MutateMode) {
-        debug!("check_assignment(assignee_cmt={})", assignee_cmt.repr());
+        debug!("check_assignment(assignee_cmt={:?})", assignee_cmt);
 
         // Mutable values can be assigned, as long as they obey loans
         // and aliasing restrictions:
@@ -884,7 +883,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());
+                debug!("mark_variable_as_used_mut(cmt={:?})", cmt);
                 match cmt.cat.clone() {
                     mc::cat_upvar(mc::Upvar { id: ty::UpvarId { var_id: id, .. }, .. }) |
                     mc::cat_local(id) => {
@@ -929,8 +928,8 @@ fn check_for_aliasable_mutable_writes<'a, 'tcx>(this: &CheckLoanCtxt<'a, 'tcx>,
             //! Safety checks related to writes to aliasable, mutable locations
 
             let guarantor = cmt.guarantor();
-            debug!("check_for_aliasable_mutable_writes(cmt={}, guarantor={})",
-                   cmt.repr(), guarantor.repr());
+            debug!("check_for_aliasable_mutable_writes(cmt={:?}, guarantor={:?})",
+                   cmt, guarantor);
             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 6f896fffd3db3f0eeff4e8dae289c868dd814452..93f5ac529d3fd2032ddea1b425e00fc7f3dbc9b3 100644 (file)
@@ -22,7 +22,7 @@
 use borrowck::move_data::{MoveData, MovePathIndex};
 use rustc::middle::ty;
 use rustc::middle::mem_categorization as mc;
-use rustc::util::ppaux::{Repr, UserString};
+
 use std::mem;
 use std::rc::Rc;
 use syntax::ast;
@@ -43,18 +43,18 @@ enum Fragment {
 
 impl Fragment {
     fn loan_path_repr(&self, move_data: &MoveData) -> String {
-        let repr = |mpi| move_data.path_loan_path(mpi).repr();
+        let lp = |mpi| move_data.path_loan_path(mpi);
         match *self {
-            Just(mpi) => repr(mpi),
-            AllButOneFrom(mpi) => format!("$(allbutone {})", repr(mpi)),
+            Just(mpi) => format!("{:?}", lp(mpi)),
+            AllButOneFrom(mpi) => format!("$(allbutone {:?})", lp(mpi)),
         }
     }
 
     fn loan_path_user_string(&self, move_data: &MoveData) -> String {
-        let user_string = |mpi| move_data.path_loan_path(mpi).user_string();
+        let lp = |mpi| move_data.path_loan_path(mpi);
         match *self {
-            Just(mpi) => user_string(mpi),
-            AllButOneFrom(mpi) => format!("$(allbutone {})", user_string(mpi)),
+            Just(mpi) => lp(mpi).to_string(),
+            AllButOneFrom(mpi) => format!("$(allbutone {})", lp(mpi)),
         }
     }
 }
@@ -124,12 +124,12 @@ 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();
+            let lp = || this.path_loan_path(*mpi);
             if span_err {
-                tcx.sess.span_err(sp, &format!("{}: `{}`", kind, render()));
+                tcx.sess.span_err(sp, &format!("{}: `{}`", kind, lp()));
             }
             if print {
-                println!("id:{} {}[{}] `{}`", id, kind, i, render());
+                println!("id:{} {}[{}] `{}`", id, kind, i, lp());
             }
         }
     };
@@ -170,7 +170,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()).collect()
+        mpis.iter().map(|mpi| format!("{:?}", this.path_loan_path(*mpi))).collect()
     };
 
     let frag_lps = |fs: &[Fragment]| -> Vec<String> {
@@ -341,8 +341,8 @@ fn add_fragment_siblings_for_extension<'tcx>(this: &MoveData<'tcx>,
             let tuple_idx = match *origin_field_name {
                 mc::PositionalField(tuple_idx) => tuple_idx,
                 mc::NamedField(_) =>
-                    panic!("tuple type {} should not have named fields.",
-                           parent_ty.repr()),
+                    panic!("tuple type {:?} should not have named fields.",
+                           parent_ty),
             };
             let tuple_len = v.len();
             for i in 0..tuple_len {
@@ -416,8 +416,8 @@ 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(), sty_and_variant_info);
+            let msg = format!("type {:?} ({:?}) is not fragmentable",
+                              parent_ty, 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[..])
         }
@@ -448,8 +448,8 @@ 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(), origin_lp.repr());
+    debug!("add_fragment_sibling_core(new_lp={:?}, origin_lp={:?})",
+           new_lp, origin_lp);
     let mp = this.move_path(tcx, Rc::new(new_lp));
 
     // Do not worry about checking for duplicates here; we will sort
index e1410daf279fe3210d3cce724c8be8c224ffc07e..7b6c54dbaca44945fa2ba02cc411743836e34e4f 100644 (file)
@@ -18,7 +18,7 @@
 use rustc::middle::mem_categorization as mc;
 use rustc::middle::mem_categorization::InteriorOffsetKind as Kind;
 use rustc::middle::ty;
-use rustc::util::ppaux::Repr;
+
 use std::rc::Rc;
 use syntax::ast;
 use syntax::codemap::Span;
@@ -66,8 +66,8 @@ pub fn gather_match_variant<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>,
                                       cmt: mc::cmt<'tcx>,
                                       mode: euv::MatchMode) {
     let tcx = bccx.tcx;
-    debug!("gather_match_variant(move_pat={}, cmt={}, mode={:?})",
-           move_pat.id, cmt.repr(), mode);
+    debug!("gather_match_variant(move_pat={}, cmt={:?}, mode={:?})",
+           move_pat.id, cmt, mode);
 
     let opt_lp = opt_loan_path(&cmt);
     match opt_lp {
@@ -115,14 +115,14 @@ fn gather_move<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>,
                          move_data: &MoveData<'tcx>,
                          move_error_collector: &MoveErrorCollector<'tcx>,
                          move_info: GatherMoveInfo<'tcx>) {
-    debug!("gather_move(move_id={}, cmt={})",
-           move_info.id, move_info.cmt.repr());
+    debug!("gather_move(move_id={}, cmt={:?})",
+           move_info.id, move_info.cmt);
 
     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());
+            debug!("illegal_move_origin={:?}", illegal_move_origin);
             let error = MoveError::with_move_info(illegal_move_origin,
                                                   move_info.span_path_opt);
             move_error_collector.add_error(error);
index e4911543e6b54b19fda6153815a50bac5e0cece2..427d78e89b3e2dbe11a787298ac418e45c1f7d5d 100644 (file)
@@ -16,7 +16,7 @@
 use rustc::middle::mem_categorization as mc;
 use rustc::middle::region;
 use rustc::middle::ty;
-use rustc::util::ppaux::Repr;
+
 use syntax::ast;
 use syntax::codemap::Span;
 
@@ -33,8 +33,8 @@ pub fn guarantee_lifetime<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>,
     //! Reports error if `loan_region` is larger than S
     //! where S is `item_scope` if `cmt` is an upvar,
     //! and is scope of `cmt` otherwise.
-    debug!("guarantee_lifetime(cmt={}, loan_region={})",
-           cmt.repr(), loan_region.repr());
+    debug!("guarantee_lifetime(cmt={:?}, loan_region={:?})",
+           cmt, loan_region);
     let ctxt = GuaranteeLifetimeContext {bccx: bccx,
                                          item_scope: item_scope,
                                          span: span,
@@ -65,9 +65,9 @@ fn check(&self, cmt: &mc::cmt<'tcx>, discr_scope: Option<ast::NodeId>) -> R {
         //! Main routine. Walks down `cmt` until we find the
         //! "guarantor".  Reports an error if `self.loan_region` is
         //! larger than scope of `cmt`.
-        debug!("guarantee_lifetime.check(cmt={}, loan_region={})",
-               cmt.repr(),
-               self.loan_region.repr());
+        debug!("guarantee_lifetime.check(cmt={:?}, loan_region={:?})",
+               cmt,
+               self.loan_region);
 
         match cmt.cat {
             mc::cat_rvalue(..) |
index a33104bff70531374fa02d41e2926e114281a760..f00eb872642f4e5173c447878e7f23caf7b108d2 100644 (file)
@@ -22,7 +22,7 @@
 use rustc::middle::mem_categorization as mc;
 use rustc::middle::region;
 use rustc::middle::ty;
-use rustc::util::ppaux::Repr;
+
 use syntax::ast;
 use syntax::codemap::Span;
 use syntax::visit;
@@ -76,8 +76,8 @@ fn consume(&mut self,
                _consume_span: Span,
                cmt: mc::cmt<'tcx>,
                mode: euv::ConsumeMode) {
-        debug!("consume(consume_id={}, cmt={}, mode={:?})",
-               consume_id, cmt.repr(), mode);
+        debug!("consume(consume_id={}, cmt={:?}, mode={:?})",
+               consume_id, cmt, mode);
 
         match mode {
             euv::Move(move_reason) => {
@@ -93,9 +93,9 @@ fn matched_pat(&mut self,
                    matched_pat: &ast::Pat,
                    cmt: mc::cmt<'tcx>,
                    mode: euv::MatchMode) {
-        debug!("matched_pat(matched_pat={}, cmt={}, mode={:?})",
-               matched_pat.repr(),
-               cmt.repr(),
+        debug!("matched_pat(matched_pat={:?}, cmt={:?}, mode={:?})",
+               matched_pat,
+               cmt,
                mode);
 
         if let mc::cat_downcast(..) = cmt.cat {
@@ -109,9 +109,9 @@ fn consume_pat(&mut self,
                    consume_pat: &ast::Pat,
                    cmt: mc::cmt<'tcx>,
                    mode: euv::ConsumeMode) {
-        debug!("consume_pat(consume_pat={}, cmt={}, mode={:?})",
-               consume_pat.repr(),
-               cmt.repr(),
+        debug!("consume_pat(consume_pat={:?}, cmt={:?}, mode={:?})",
+               consume_pat,
+               cmt,
                mode);
 
         match mode {
@@ -132,9 +132,9 @@ fn borrow(&mut self,
               bk: ty::BorrowKind,
               loan_cause: euv::LoanCause)
     {
-        debug!("borrow(borrow_id={}, cmt={}, loan_region={:?}, \
+        debug!("borrow(borrow_id={}, cmt={:?}, loan_region={:?}, \
                bk={:?}, loan_cause={:?})",
-               borrow_id, cmt.repr(), loan_region,
+               borrow_id, cmt, loan_region,
                bk, loan_cause);
 
         self.guarantee_valid(borrow_id,
@@ -152,8 +152,8 @@ fn mutate(&mut self,
               mode: euv::MutateMode)
     {
         let opt_lp = opt_loan_path(&assignee_cmt);
-        debug!("mutate(assignment_id={}, assignee_cmt={}) opt_lp={:?}",
-               assignment_id, assignee_cmt.repr(), opt_lp);
+        debug!("mutate(assignment_id={}, assignee_cmt={:?}) opt_lp={:?}",
+               assignment_id, assignee_cmt, opt_lp);
 
         match opt_lp {
             Some(lp) => {
@@ -234,10 +234,10 @@ fn guarantee_valid(&mut self,
                        req_kind: ty::BorrowKind,
                        loan_region: ty::Region,
                        cause: euv::LoanCause) {
-        debug!("guarantee_valid(borrow_id={}, cmt={}, \
+        debug!("guarantee_valid(borrow_id={}, cmt={:?}, \
                 req_mutbl={:?}, loan_region={:?})",
                borrow_id,
-               cmt.repr(),
+               cmt,
                req_kind,
                loan_region);
 
@@ -336,8 +336,8 @@ fn guarantee_valid(&mut self,
             }
         };
 
-        debug!("guarantee_valid(borrow_id={}), loan={}",
-               borrow_id, loan.repr());
+        debug!("guarantee_valid(borrow_id={}), loan={:?}",
+               borrow_id, loan);
 
         // let loan_path = loan.loan_path;
         // let loan_gen_scope = loan.gen_scope;
@@ -376,8 +376,8 @@ fn check_mutability<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>,
                                       req_kind: ty::BorrowKind)
                                       -> Result<(),()> {
             //! Implements the M-* rules in README.md.
-            debug!("check_mutability(cause={:?} cmt={} req_kind={:?}",
-                   cause, cmt.repr(), req_kind);
+            debug!("check_mutability(cause={:?} cmt={:?} req_kind={:?}",
+                   cause, cmt, 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());
+    debug!("gather_loans_in_static_initializer(expr={:?})", expr);
 
     let mut sicx = StaticInitializerCtxt {
         bccx: bccx
index bc52fc7622cf1a127f5cd1ef71cea7f203beabea..9a29ed91339e2468646da1c59d408dc1b7b35870 100644 (file)
@@ -12,7 +12,6 @@
 use rustc::middle::mem_categorization as mc;
 use rustc::middle::mem_categorization::InteriorOffsetKind as Kind;
 use rustc::middle::ty;
-use rustc::util::ppaux::UserString;
 use std::cell::RefCell;
 use syntax::ast;
 use syntax::codemap;
@@ -130,7 +129,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()));
+                                       b.ty));
             }
         }
 
@@ -143,7 +142,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()));
+                                b.ty));
                 },
                 _ => {
                     bccx.span_bug(move_from.span, "this path should not cause illegal move")
index 274a08dfe1108535a13edee10fa1988f801db0d6..345f5378f69e106c0fd3142f66d31f94229f3de1 100644 (file)
@@ -16,7 +16,6 @@
 use rustc::middle::expr_use_visitor as euv;
 use rustc::middle::mem_categorization as mc;
 use rustc::middle::ty;
-use rustc::util::ppaux::Repr;
 use syntax::codemap::Span;
 
 use borrowck::ToInteriorKind;
@@ -58,7 +57,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());
+        debug!("restrict(cmt={:?})", cmt);
 
         let new_lp = |v: LoanPathKind<'tcx>| Rc::new(LoanPath::new(v, cmt.ty));
 
index 63d9383d69d553a49dab7b0f050249313914017c..6369621779cbd5ed3e99eb557328e1c9ff8de881 100644 (file)
@@ -33,7 +33,6 @@
 use rustc::middle::mem_categorization as mc;
 use rustc::middle::region;
 use rustc::middle::ty::{self, Ty};
-use rustc::util::ppaux::{Repr, UserString};
 
 use std::fmt;
 use std::mem;
@@ -683,7 +682,7 @@ pub fn report_use_of_moved_value<'b>(&self,
                                   which is {}",
                                  ol,
                                  moved_lp_msg,
-                                 expr_ty.user_string(),
+                                 expr_ty,
                                  suggestion));
                 } else {
                     self.tcx.sess.span_note(
@@ -691,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(),
+                                 expr_ty,
                                  suggestion));
                 }
             }
@@ -704,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()));
+                            pat_ty));
                 self.tcx.sess.fileline_help(span,
                     "use `ref` to override");
             }
@@ -735,7 +734,7 @@ pub fn report_use_of_moved_value<'b>(&self,
                             has type `{}`, which is {}",
                             ol,
                             moved_lp_msg,
-                            expr_ty.user_string(),
+                            expr_ty,
                             suggestion));
                 self.tcx.sess.fileline_help(expr_span, help);
             }
@@ -1187,7 +1186,7 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
                 let variant_str = if variant_def_id.krate == ast::LOCAL_CRATE {
                     ty::tls::with(|tcx| ty::item_path_str(tcx, variant_def_id))
                 } else {
-                    variant_def_id.repr()
+                    format!("{:?}", variant_def_id)
                 };
                 write!(f, "({:?}{}{})", lp, DOWNCAST_PRINTED_OPERATOR, variant_str)
             }
@@ -1219,7 +1218,7 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
                 let variant_str = if variant_def_id.krate == ast::LOCAL_CRATE {
                     ty::tls::with(|tcx| ty::item_path_str(tcx, variant_def_id))
                 } else {
-                    variant_def_id.repr()
+                    format!("{:?}", variant_def_id)
                 };
                 write!(f, "({}{}{})", lp, DOWNCAST_PRINTED_OPERATOR, variant_str)
             }
index 1b9b15a673aea6464d69dd2c2b8e85e1221dda58..b38915612c5b0c453d83b30148a024e473acd553 100644 (file)
@@ -22,7 +22,7 @@
 use rustc::middle::expr_use_visitor as euv;
 use rustc::middle::ty;
 use rustc::util::nodemap::{FnvHashMap, NodeSet};
-use rustc::util::ppaux::Repr;
+
 use std::cell::RefCell;
 use std::rc::Rc;
 use std::usize;
@@ -313,8 +313,8 @@ pub fn move_path(&self,
             }
         };
 
-        debug!("move_path(lp={}, index={:?})",
-               lp.repr(),
+        debug!("move_path(lp={:?}, index={:?})",
+               lp,
                index);
 
         assert_eq!(index.get(), self.paths.borrow().len() - 1);
@@ -364,8 +364,8 @@ pub fn add_move(&self,
                     lp: Rc<LoanPath<'tcx>>,
                     id: ast::NodeId,
                     kind: MoveKind) {
-        debug!("add_move(lp={}, id={}, kind={:?})",
-               lp.repr(),
+        debug!("add_move(lp={:?}, id={}, kind={:?})",
+               lp,
                id,
                kind);
 
@@ -394,8 +394,8 @@ pub fn add_assignment(&self,
                           span: Span,
                           assignee_id: ast::NodeId,
                           mode: euv::MutateMode) {
-        debug!("add_assignment(lp={}, assign_id={}, assignee_id={}",
-               lp.repr(), assign_id, assignee_id);
+        debug!("add_assignment(lp={:?}, assign_id={}, assignee_id={}",
+               lp, assign_id, assignee_id);
 
         let path_index = self.move_path(tcx, lp.clone());
 
@@ -415,13 +415,13 @@ pub fn add_assignment(&self,
         };
 
         if self.is_var_path(path_index) {
-            debug!("add_assignment[var](lp={}, assignment={}, path_index={:?})",
-                   lp.repr(), self.var_assignments.borrow().len(), path_index);
+            debug!("add_assignment[var](lp={:?}, assignment={}, path_index={:?})",
+                   lp, self.var_assignments.borrow().len(), path_index);
 
             self.var_assignments.borrow_mut().push(assignment);
         } else {
-            debug!("add_assignment[path](lp={}, path_index={:?})",
-                   lp.repr(), path_index);
+            debug!("add_assignment[path](lp={:?}, path_index={:?})",
+                   lp, path_index);
 
             self.path_assignments.borrow_mut().push(assignment);
         }
@@ -437,8 +437,8 @@ pub fn add_variant_match(&self,
                              pattern_id: ast::NodeId,
                              base_lp: Rc<LoanPath<'tcx>>,
                              mode: euv::MatchMode) {
-        debug!("add_variant_match(lp={}, pattern_id={})",
-               lp.repr(), pattern_id);
+        debug!("add_variant_match(lp={:?}, pattern_id={})",
+               lp, pattern_id);
 
         let path_index = self.move_path(tcx, lp.clone());
         let base_path_index = self.move_path(tcx, base_lp.clone());
index 7f079669911053a550f3eef60c46dff5e33f2c7c..a40cb94204d9c82b34fb14eff8b409adf69d4bac 100644 (file)
@@ -25,7 +25,6 @@
 use rustc::middle::cfg::graphviz::LabelledCFG;
 use rustc::session::Session;
 use rustc::session::config::Input;
-use rustc::util::ppaux::UserString;
 use rustc_borrowck as borrowck;
 use rustc_borrowck::graphviz as borrowck_dot;
 use rustc_resolve as resolve;
@@ -318,7 +317,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()));
+                              &ty::expr_ty(self.tcx, expr).to_string()));
                 s.pclose()
             }
             _ => Ok(())
index 658d5166ef5fc04485a56b501e76b8f6216b314d..5183fa01a8ac414425809ab051b0033969d2b51a 100644 (file)
@@ -28,7 +28,6 @@
 use rustc_typeck::middle::infer::lub::Lub;
 use rustc_typeck::middle::infer::glb::Glb;
 use rustc_typeck::middle::infer::sub::Sub;
-use rustc_typeck::util::ppaux::{Repr, UserString};
 use rustc::ast_map;
 use rustc::session::{self,config};
 use syntax::{abi, ast};
@@ -188,7 +187,7 @@ fn search_mod(this: &Env,
                       -> Option<ast::NodeId> {
             assert!(idx < names.len());
             for item in &m.items {
-                if item.ident.user_string() == names[idx] {
+                if item.ident.to_string() == names[idx] {
                     return search(this, &**item, idx+1, names);
                 }
             }
@@ -240,9 +239,7 @@ pub fn is_subtype(&self, a: Ty<'tcx>, b: Ty<'tcx>) -> bool {
 
     pub fn assert_subtype(&self, a: Ty<'tcx>, b: Ty<'tcx>) {
         if !self.is_subtype(a, b) {
-            panic!("{} is not a subtype of {}, but it should be",
-                  self.ty_to_string(a),
-                  self.ty_to_string(b));
+            panic!("{} is not a subtype of {}, but it should be", a, b);
         }
     }
 
@@ -251,10 +248,6 @@ pub fn assert_eq(&self, a: Ty<'tcx>, b: Ty<'tcx>) {
         self.assert_subtype(b, a);
     }
 
-    pub fn ty_to_string(&self, a: Ty<'tcx>) -> String {
-         a.user_string()
-    }
-
     pub fn t_fn(&self,
                 input_tys: &[Ty<'tcx>],
                 output_ty: Ty<'tcx>)
@@ -385,9 +378,9 @@ pub fn check_sub(&self, t1: Ty<'tcx>, t2: Ty<'tcx>) {
         match self.sub().relate(&t1, &t2) {
             Ok(_) => { }
             Err(ref e) => {
-                panic!("unexpected error computing sub({},{}): {}",
-                       t1.repr(),
-                       t2.repr(),
+                panic!("unexpected error computing sub({:?},{:?}): {}",
+                       t1,
+                       t2,
                        e);
             }
         }
@@ -399,9 +392,9 @@ pub fn check_not_sub(&self, t1: Ty<'tcx>, t2: Ty<'tcx>) {
         match self.sub().relate(&t1, &t2) {
             Err(_) => { }
             Ok(_) => {
-                panic!("unexpected success computing sub({},{})",
-                       t1.repr(),
-                       t2.repr());
+                panic!("unexpected success computing sub({:?},{:?})",
+                       t1,
+                       t2);
             }
         }
     }
@@ -420,10 +413,7 @@ pub fn check_lub(&self, t1: Ty<'tcx>, t2: Ty<'tcx>, t_lub: Ty<'tcx>) {
 
     /// Checks that `GLB(t1,t2) == t_glb`
     pub fn check_glb(&self, t1: Ty<'tcx>, t2: Ty<'tcx>, t_glb: Ty<'tcx>) {
-        debug!("check_glb(t1={}, t2={}, t_glb={})",
-               self.ty_to_string(t1),
-               self.ty_to_string(t2),
-               self.ty_to_string(t_glb));
+        debug!("check_glb(t1={}, t2={}, t_glb={})", t1, t2, t_glb);
         match self.glb().relate(&t1, &t2) {
             Err(e) => {
                 panic!("unexpected error computing LUB: {:?}", e)
@@ -656,7 +646,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()); }
+            _ => { panic!("t_resolve1={:?}", t_resolve1); }
         }
     })
 }
@@ -698,11 +688,11 @@ fn subst_ty_renumber_bound() {
             env.t_fn(&[t_ptr_bound2], env.t_nil())
         };
 
-        debug!("subst_bound: t_source={} substs={} t_substituted={} t_expected={}",
-               t_source.repr(),
-               substs.repr(),
-               t_substituted.repr(),
-               t_expected.repr());
+        debug!("subst_bound: t_source={:?} substs={:?} t_substituted={:?} t_expected={:?}",
+               t_source,
+               substs,
+               t_substituted,
+               t_expected);
 
         assert_eq!(t_substituted, t_expected);
     })
@@ -735,11 +725,11 @@ fn subst_ty_renumber_some_bounds() {
             env.t_pair(t_rptr_bound1, env.t_fn(&[t_rptr_bound2], env.t_nil()))
         };
 
-        debug!("subst_bound: t_source={} substs={} t_substituted={} t_expected={}",
-               t_source.repr(),
-               substs.repr(),
-               t_substituted.repr(),
-               t_expected.repr());
+        debug!("subst_bound: t_source={:?} substs={:?} t_substituted={:?} t_expected={:?}",
+               t_source,
+               substs,
+               t_substituted,
+               t_expected);
 
         assert_eq!(t_substituted, t_expected);
     })
@@ -796,11 +786,11 @@ fn subst_region_renumber_region() {
             env.t_fn(&[t_rptr_bound2], env.t_nil())
         };
 
-        debug!("subst_bound: t_source={} substs={} t_substituted={} t_expected={}",
-               t_source.repr(),
-               substs.repr(),
-               t_substituted.repr(),
-               t_expected.repr());
+        debug!("subst_bound: t_source={:?} substs={:?} t_substituted={:?} t_expected={:?}",
+               t_source,
+               substs,
+               t_substituted,
+               t_expected);
 
         assert_eq!(t_substituted, t_expected);
     })
index ed8f7372b660c20fc42d4e4d409785977e68d733..47713859dd8cbda4196051f0ecb7d8f9c66956b2 100644 (file)
@@ -37,7 +37,6 @@
 use middle::cfg;
 use rustc::ast_map;
 use util::nodemap::{FnvHashMap, NodeSet};
-use util::ppaux::UserString;
 use lint::{Level, Context, LintPass, LintArray, Lint};
 
 use std::collections::{HashSet, BitSet};
@@ -495,8 +494,7 @@ fn check_heap_type<'a, 'tcx>(&self, cx: &Context<'a, 'tcx>,
         });
 
         if n_uniq > 0 {
-            let s =  ty.user_string();
-            let m = format!("type uses owned (Box type) pointers: {}", s);
+            let m = format!("type uses owned (Box type) pointers: {}", ty);
             cx.span_lint(BOX_POINTERS, span, &m[..]);
         }
     }
index eeebe03c21ba10af634e94d9688919e3d5b37e88..f6f9afa02215a9a35b494a60e2ae691ce98bf3be 100644 (file)
@@ -25,7 +25,6 @@
 use rustc::ast_map::{PathElem, PathElems, PathName};
 use trans::{CrateContext, CrateTranslation, gensym_name};
 use util::common::time;
-use util::ppaux::UserString;
 use util::sha2::{Digest, Sha256};
 use util::fs::fix_windows_verbatim_for_gcc;
 use rustc_back::tempdir::TempDir;
@@ -347,7 +346,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())),
+    let path = [PathName(token::intern(&t.to_string())),
                 gensym_name(name)];
     let hash = get_symbol_hash(ccx, t);
     mangle(path.iter().cloned(), Some(&hash[..]))
index fb174d8ff276ea9193e5838f31ee6f94e0fb3f00..65d9d9809c926ce8ef1afc98512bb79d70470089 100644 (file)
@@ -52,8 +52,6 @@
 use super::span_utils::SpanUtils;
 use super::recorder::{Recorder, FmtStrs};
 
-use util::ppaux::UserString;
-
 macro_rules! down_cast_data {
     ($id:ident, $kind:ident, $this:ident, $sp:expr) => {
         let $id = if let super::Data::$kind(data) = $id {
@@ -287,7 +285,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();
+                let typ = self.tcx.node_types().get(&id).unwrap().to_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 +1390,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();
+            let typ = types.get(&id).unwrap().to_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 efdc1195a952893dd47090a8f812941fc62e8437..fdfb101ed78cc4be6485a13a7caa40a30869469d 100644 (file)
@@ -23,8 +23,6 @@
 use syntax::visit::{self, Visitor};
 use syntax::print::pprust::ty_to_string;
 
-use util::ppaux::UserString;
-
 use self::span_utils::SpanUtils;
 
 
@@ -293,7 +291,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();
+                                               .to_string();
                 let sub_span = self.span_utils.sub_span_before_token(field.span, token::Colon);
                 Some(Data::VariableData(VariableData {
                     id: field.node.id,
index 7f68e654c2c5370653cae99135ab8db82cd31fb0..05672153b018a5899f3d0b2860d0def701860a1f 100644 (file)
 use session::config::{NoDebugInfo, FullDebugInfo};
 use util::common::indenter;
 use util::nodemap::FnvHashMap;
-use util::ppaux::{self, Repr};
+use util::ppaux;
 
 use std;
 use std::cmp::Ordering;
@@ -398,9 +398,9 @@ fn expand_nested_bindings<'a, 'p, 'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
                                               col: usize,
                                               val: ValueRef)
                                               -> Vec<Match<'a, 'p, 'blk, 'tcx>> {
-    debug!("expand_nested_bindings(bcx={}, m={}, col={}, val={})",
+    debug!("expand_nested_bindings(bcx={}, m={:?}, col={}, val={})",
            bcx.to_str(),
-           m.repr(),
+           m,
            col,
            bcx.val_to_string(val));
     let _indenter = indenter();
@@ -438,9 +438,9 @@ fn enter_match<'a, 'b, 'p, 'blk, 'tcx, F>(bcx: Block<'blk, 'tcx>,
                                           -> Vec<Match<'a, 'p, 'blk, 'tcx>> where
     F: FnMut(&[&'p ast::Pat]) -> Option<Vec<&'p ast::Pat>>,
 {
-    debug!("enter_match(bcx={}, m={}, col={}, val={})",
+    debug!("enter_match(bcx={}, m={:?}, col={}, val={})",
            bcx.to_str(),
-           m.repr(),
+           m,
            col,
            bcx.val_to_string(val));
     let _indenter = indenter();
@@ -481,9 +481,9 @@ fn enter_default<'a, 'p, 'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
                                      col: usize,
                                      val: ValueRef)
                                      -> Vec<Match<'a, 'p, 'blk, 'tcx>> {
-    debug!("enter_default(bcx={}, m={}, col={}, val={})",
+    debug!("enter_default(bcx={}, m={:?}, col={}, val={})",
            bcx.to_str(),
-           m.repr(),
+           m,
            col,
            bcx.val_to_string(val));
     let _indenter = indenter();
@@ -538,9 +538,9 @@ fn enter_opt<'a, 'p, 'blk, 'tcx>(
              variant_size: usize,
              val: ValueRef)
              -> Vec<Match<'a, 'p, 'blk, 'tcx>> {
-    debug!("enter_opt(bcx={}, m={}, opt={:?}, col={}, val={})",
+    debug!("enter_opt(bcx={}, m={:?}, opt={:?}, col={}, val={})",
            bcx.to_str(),
-           m.repr(),
+           m,
            *opt,
            col,
            bcx.val_to_string(val));
@@ -826,8 +826,7 @@ fn compare_str<'blk, 'tcx>(cx: Block<'blk, 'tcx>,
                                -> Result<'blk, 'tcx> {
         let did = langcall(cx,
                            None,
-                           &format!("comparison of `{}`",
-                                   cx.ty_to_string(rhs_t)),
+                           &format!("comparison of `{}`", rhs_t),
                            StrEqFnLangItem);
         let t = ty::mk_str_slice(cx.tcx(), cx.tcx().mk_region(ty::ReStatic), ast::MutImmutable);
         // The comparison function gets the slices by value, so we have to make copies here. Even
@@ -938,10 +937,10 @@ fn compile_guard<'a, 'p, 'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
                                      chk: &FailureHandler,
                                      has_genuine_default: bool)
                                      -> Block<'blk, 'tcx> {
-    debug!("compile_guard(bcx={}, guard_expr={}, m={}, vals=[{}])",
+    debug!("compile_guard(bcx={}, guard_expr={:?}, m={:?}, vals=[{}])",
            bcx.to_str(),
-           bcx.expr_to_string(guard_expr),
-           m.repr(),
+           guard_expr,
+           m,
            vals.iter().map(|v| bcx.val_to_string(*v)).collect::<Vec<_>>().connect(", "));
     let _indenter = indenter();
 
@@ -984,9 +983,9 @@ fn compile_submatch<'a, 'p, 'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
                                         vals: &[ValueRef],
                                         chk: &FailureHandler,
                                         has_genuine_default: bool) {
-    debug!("compile_submatch(bcx={}, m={}, vals=[{}])",
+    debug!("compile_submatch(bcx={}, m={:?}, vals=[{}])",
            bcx.to_str(),
-           m.repr(),
+           m,
            vals.iter().map(|v| bcx.val_to_string(*v)).collect::<Vec<_>>().connect(", "));
     let _indenter = indenter();
     let _icx = push_ctxt("match::compile_submatch");
@@ -1697,13 +1696,13 @@ fn bind_irrefutable_pat<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
                                     val: ValueRef,
                                     cleanup_scope: cleanup::ScopeId)
                                     -> Block<'blk, 'tcx> {
-    debug!("bind_irrefutable_pat(bcx={}, pat={})",
+    debug!("bind_irrefutable_pat(bcx={}, pat={:?})",
            bcx.to_str(),
-           pat.repr());
+           pat);
 
     if bcx.sess().asm_comments() {
-        add_comment(bcx, &format!("bind_irrefutable_pat(pat={})",
-                                 pat.repr()));
+        add_comment(bcx, &format!("bind_irrefutable_pat(pat={:?})",
+                                 pat));
     }
 
     let _indenter = indenter();
index dc5d3ea2f624890b90548302f9021f97ddc603b9..2a1c2457b9d32d5a6d7d287a07710698809ae5a8 100644 (file)
@@ -66,7 +66,6 @@
 use trans::monomorphize;
 use trans::type_::Type;
 use trans::type_of;
-use util::ppaux::Repr as PrettyPrintRepr;
 
 type Hint = attr::ReprAttr;
 
@@ -143,7 +142,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());
+    debug!("Representing: {}", t);
     match cx.adt_reprs().borrow().get(&t) {
         Some(repr) => return repr.clone(),
         None => {}
@@ -381,8 +380,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.sess().bug(&format!("adt::represent_type called on non-ADT type: {}", t))
     }
 }
 
index 81657c9537066cae89f4a126634646efd3ce8755..eb0d19efef00a25de7309bf98cf5e6d05ceb1234 100644 (file)
@@ -80,7 +80,6 @@
 use trans::type_of::*;
 use trans::value::Value;
 use util::common::indenter;
-use util::ppaux::Repr;
 use util::sha2::Sha256;
 use util::nodemap::NodeMap;
 
@@ -250,9 +249,7 @@ fn require_alloc_fn<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
     match bcx.tcx().lang_items.require(it) {
         Ok(id) => id,
         Err(s) => {
-            bcx.sess().fatal(&format!("allocation of `{}` {}",
-                                     bcx.ty_to_string(info_ty),
-                                     s));
+            bcx.sess().fatal(&format!("allocation of `{}` {}", info_ty, s));
         }
     }
 }
@@ -530,8 +527,7 @@ fn iter_variant<'blk, 'tcx, F>(cx: Block<'blk, 'tcx>,
           }
       }
       _ => {
-          cx.sess().unimpl(&format!("type in iter_structural_ty: {}",
-                                    t.repr()))
+          cx.sess().unimpl(&format!("type in iter_structural_ty: {}", t))
       }
     }
     return cx;
@@ -640,8 +636,7 @@ pub fn fail_if_zero_or_overflows<'blk, 'tcx>(
             (res, false)
         }
         _ => {
-            cx.sess().bug(&format!("fail-if-zero on unexpected type: {}",
-                                   rhs_t.repr()));
+            cx.sess().bug(&format!("fail-if-zero on unexpected type: {}", rhs_t));
         }
     };
     let bcx = with_cond(cx, is_zero, |bcx| {
@@ -1187,13 +1182,13 @@ pub fn new_fn_ctxt<'a, 'tcx>(ccx: &'a CrateContext<'a, 'tcx>,
                              -> FunctionContext<'a, 'tcx> {
     common::validate_substs(param_substs);
 
-    debug!("new_fn_ctxt(path={}, id={}, param_substs={})",
+    debug!("new_fn_ctxt(path={}, id={}, param_substs={:?})",
            if id == !0 {
                "".to_string()
            } else {
                ccx.tcx().map.path_to_string(id).to_string()
            },
-           id, param_substs.repr());
+           id, param_substs);
 
     let uses_outptr = match output_type {
         ty::FnConverging(output_type) => {
@@ -1510,8 +1505,8 @@ pub fn trans_closure<'a, 'b, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
     let _icx = push_ctxt("trans_closure");
     attributes::emit_uwtable(llfndecl, true);
 
-    debug!("trans_closure(..., param_substs={})",
-           param_substs.repr());
+    debug!("trans_closure(..., param_substs={:?})",
+           param_substs);
 
     let has_env = match closure_env {
         closure::ClosureEnv::Closure(_) => true,
@@ -1553,8 +1548,8 @@ 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());
+        debug!("trans_closure: monomorphized_arg_type: {:?}",
+               monomorphized_arg_type);
     }
     debug!("trans_closure: function lltype: {}",
            bcx.fcx.ccx.tn().val_to_string(bcx.fcx.llfn));
@@ -1636,7 +1631,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());
+    debug!("trans_fn(param_substs={:?})", param_substs);
     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));
@@ -1679,7 +1674,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()))
+                     ctor_ty))
     };
 
     // Get location to store the result. If the user does not care about
@@ -1757,7 +1752,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()))
+                    ctor_ty))
     };
 
     let (arena, fcx): (TypedArena<_>, FunctionContext);
index a06598a7cbe3318ff708f4c0eb260aa5e3ff91e3..46f762a5195851877ab1ae8bcf55545d544780a1 100644 (file)
@@ -54,7 +54,6 @@
 use middle::ty::{self, Ty};
 use middle::ty::MethodCall;
 use rustc::ast_map;
-use util::ppaux::Repr;
 
 use syntax::abi as synabi;
 use syntax::ast;
@@ -89,7 +88,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());
+    debug!("callee::trans(expr={:?})", expr);
 
     // pick out special kinds of expressions that can be called:
     match expr.node {
@@ -117,7 +116,7 @@ fn datum_callee<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, expr: &ast::Expr)
                 bcx.tcx().sess.span_bug(
                     expr.span,
                     &format!("type of callee is neither bare-fn nor closure: {}",
-                             bcx.ty_to_string(datum.ty)));
+                             datum.ty));
             }
         }
     }
@@ -134,7 +133,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(), ref_expr.repr());
+        debug!("trans_def(def={:?}, ref_expr={:?})", def, ref_expr);
         let expr_ty = common::node_id_type(bcx, ref_expr.id);
         match def {
             def::DefFn(did, _) if {
@@ -228,10 +227,10 @@ pub fn trans_fn_ref<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
     let _icx = push_ctxt("trans_fn_ref");
 
     let substs = common::node_id_substs(ccx, node, param_substs);
-    debug!("trans_fn_ref(def_id={}, node={:?}, substs={})",
-           def_id.repr(),
+    debug!("trans_fn_ref(def_id={:?}, node={:?}, substs={:?})",
+           def_id,
            node,
-           substs.repr());
+           substs);
     trans_fn_ref_with_substs(ccx, def_id, node, param_substs, substs)
 }
 
@@ -291,8 +290,8 @@ pub fn trans_fn_pointer_shim<'a, 'tcx>(
         None => { }
     }
 
-    debug!("trans_fn_pointer_shim(bare_fn_ty={})",
-           bare_fn_ty.repr());
+    debug!("trans_fn_pointer_shim(bare_fn_ty={:?})",
+           bare_fn_ty);
 
     // 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 +306,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()));
+                                      bare_fn_ty));
             }
         };
     let sig = ty::erase_late_bound_regions(tcx, sig);
@@ -323,7 +322,7 @@ pub fn trans_fn_pointer_shim<'a, 'tcx>(
                                              output: sig.output,
                                              variadic: false
                                          })}));
-    debug!("tuple_fn_ty: {}", tuple_fn_ty.repr());
+    debug!("tuple_fn_ty: {:?}", tuple_fn_ty);
 
     //
     let function_name = link::mangle_internal_name_by_type_and_seq(ccx, bare_fn_ty,
@@ -401,12 +400,12 @@ pub fn trans_fn_ref_with_substs<'a, 'tcx>(
     let _icx = push_ctxt("trans_fn_ref_with_substs");
     let tcx = ccx.tcx();
 
-    debug!("trans_fn_ref_with_substs(def_id={}, node={:?}, \
-            param_substs={}, substs={})",
-           def_id.repr(),
+    debug!("trans_fn_ref_with_substs(def_id={:?}, node={:?}, \
+            param_substs={:?}, substs={:?})",
+           def_id,
            node,
-           param_substs.repr(),
-           substs.repr());
+           param_substs,
+           substs);
 
     assert!(substs.types.all(|t| !ty::type_needs_infer(*t)));
     assert!(substs.types.all(|t| !ty::type_has_escaping_regions(*t)));
@@ -457,10 +456,10 @@ pub fn trans_fn_ref_with_substs<'a, 'tcx>(
                     let new_substs = tcx.mk_substs(first_subst.subst(tcx, &substs));
 
                     debug!("trans_fn_with_vtables - default method: \
-                            substs = {}, trait_subst = {}, \
-                            first_subst = {}, new_subst = {}",
-                           substs.repr(), trait_ref.substs.repr(),
-                           first_subst.repr(), new_substs.repr());
+                            substs = {:?}, trait_subst = {:?}, \
+                            first_subst = {:?}, new_subst = {:?}",
+                           substs, trait_ref.substs,
+                           first_subst, new_substs);
 
                     (true, source_id, new_substs)
                 }
@@ -504,8 +503,8 @@ pub fn trans_fn_ref_with_substs<'a, 'tcx>(
         false
     };
 
-    debug!("trans_fn_ref_with_substs({}) must_monomorphise: {}",
-           def_id.repr(), must_monomorphise);
+    debug!("trans_fn_ref_with_substs({:?}) must_monomorphise: {}",
+           def_id, must_monomorphise);
 
     // Create a monomorphic version of generic functions
     if must_monomorphise {
@@ -615,7 +614,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());
+    debug!("trans_method_call(call_expr={:?})", call_expr);
     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 {
@@ -1125,8 +1124,8 @@ pub fn trans_arg_datum<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
     let mut bcx = bcx;
     let ccx = bcx.ccx();
 
-    debug!("trans_arg_datum({})",
-           formal_arg_ty.repr());
+    debug!("trans_arg_datum({:?})",
+           formal_arg_ty);
 
     let arg_datum_ty = arg_datum.ty;
 
@@ -1165,8 +1164,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(),
-                                     formal_arg_ty.repr());
+        debug!("Rust types: {:?}; {:?}", arg_datum_ty,
+                                     formal_arg_ty);
         val = PointerCast(bcx, val, llformal_arg_ty);
     }
 
index 97fe4dfb2a7a6d38448066e67b73461b1c3d6012..6355a713a2ce61b1898062f89b5fd57598d3a955 100644 (file)
 use middle::ty::{self, Ty};
 use std::fmt;
 use syntax::ast;
-use util::ppaux::Repr;
 
 pub struct CleanupScope<'blk, 'tcx: 'blk> {
     // The id of this cleanup scope. If the id is None,
@@ -397,10 +396,10 @@ fn schedule_drop_mem(&self,
             skip_dtor: false,
         };
 
-        debug!("schedule_drop_mem({:?}, val={}, ty={}) fill_on_drop={} skip_dtor={}",
+        debug!("schedule_drop_mem({:?}, val={}, ty={:?}) fill_on_drop={} skip_dtor={}",
                cleanup_scope,
                self.ccx.tn().val_to_string(val),
-               ty.repr(),
+               ty,
                drop.fill_on_drop,
                drop.skip_dtor);
 
@@ -423,10 +422,10 @@ fn schedule_drop_and_fill_mem(&self,
             skip_dtor: false,
         };
 
-        debug!("schedule_drop_and_fill_mem({:?}, val={}, ty={}, fill_on_drop={}, skip_dtor={})",
+        debug!("schedule_drop_and_fill_mem({:?}, val={}, ty={:?}, fill_on_drop={}, skip_dtor={})",
                cleanup_scope,
                self.ccx.tn().val_to_string(val),
-               ty.repr(),
+               ty,
                drop.fill_on_drop,
                drop.skip_dtor);
 
@@ -455,10 +454,10 @@ fn schedule_drop_adt_contents(&self,
             skip_dtor: true,
         };
 
-        debug!("schedule_drop_adt_contents({:?}, val={}, ty={}) fill_on_drop={} skip_dtor={}",
+        debug!("schedule_drop_adt_contents({:?}, val={}, ty={:?}) fill_on_drop={} skip_dtor={}",
                cleanup_scope,
                self.ccx.tn().val_to_string(val),
-               ty.repr(),
+               ty,
                drop.fill_on_drop,
                drop.skip_dtor);
 
@@ -484,7 +483,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(),
+               ty,
                drop.fill_on_drop,
                drop.skip_dtor);
 
index ef8839c6d5d142d40a5fb6a0d20440f6cbbc3b36..91b0a6c00696fb08998c15f402d869b3f603c481 100644 (file)
@@ -28,7 +28,6 @@
 use middle::ty::{self, ClosureTyper};
 use middle::subst::Substs;
 use session::config::FullDebugInfo;
-use util::ppaux::Repr;
 
 use syntax::abi::RustCall;
 use syntax::ast;
@@ -353,9 +352,9 @@ fn trans_fn_once_adapter_shim<'a, 'tcx>(
     llreffn: ValueRef)
     -> ValueRef
 {
-    debug!("trans_fn_once_adapter_shim(closure_def_id={}, substs={}, llreffn={})",
-           closure_def_id.repr(),
-           substs.repr(),
+    debug!("trans_fn_once_adapter_shim(closure_def_id={:?}, substs={:?}, llreffn={})",
+           closure_def_id,
+           substs,
            ccx.tn().val_to_string(llreffn));
 
     let tcx = ccx.tcx();
@@ -374,8 +373,8 @@ fn trans_fn_once_adapter_shim<'a, 'tcx>(
                                                                abi: abi,
                                                                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());
+    debug!("trans_fn_once_adapter_shim: llref_fn_ty={:?}",
+           llref_fn_ty);
 
     // Make a version of the closure type with the same arguments, but
     // with argument #0 being by value.
@@ -423,8 +422,8 @@ fn trans_fn_once_adapter_shim<'a, 'tcx>(
     let input_tys = match sig.inputs[1].sty {
         ty::TyTuple(ref tys) => &**tys,
         _ => bcx.sess().bug(&format!("trans_fn_once_adapter_shim: not rust-call! \
-                                      closure_def_id={}",
-                                     closure_def_id.repr()))
+                                      closure_def_id={:?}",
+                                     closure_def_id))
     };
     let llargs: Vec<_> =
         input_tys.iter()
index 22582787c7c0b1f7818d531ab8c48368070b07a1..5dddf161e69fbf802adf6622a01923356213f7f4 100644 (file)
@@ -41,7 +41,6 @@
 use middle::ty_fold;
 use middle::ty_fold::{TypeFolder, TypeFoldable};
 use rustc::ast_map::{PathElem, PathName};
-use util::ppaux::Repr;
 use util::nodemap::{FnvHashMap, NodeMap};
 
 use arena::TypedArena;
@@ -67,8 +66,8 @@ pub fn erase_regions<'tcx,T>(cx: &ty::ctxt<'tcx>, value: &T) -> T
     where T : TypeFoldable<'tcx>
 {
     let value1 = value.fold_with(&mut RegionEraser(cx));
-    debug!("erase_regions({}) = {}",
-           value.repr(), value1.repr());
+    debug!("erase_regions({:?}) = {:?}",
+           value, value1);
     return value1;
 
     struct RegionEraser<'a, 'tcx: 'a>(&'a ty::ctxt<'tcx>);
@@ -212,7 +211,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(), contents);
+    debug!("type_needs_drop ty={:?} contents={:?}", ty, contents);
     contents.needs_drop(cx)
 }
 
@@ -593,10 +592,6 @@ pub fn node_id_to_string(&self, id: ast::NodeId) -> String {
         self.tcx().map.node_to_string(id).to_string()
     }
 
-    pub fn expr_to_string(&self, e: &ast::Expr) -> String {
-        e.repr()
-    }
-
     pub fn def(&self, nid: ast::NodeId) -> def::Def {
         match self.tcx().def_map.borrow().get(&nid) {
             Some(v) => v.full_def(),
@@ -615,10 +610,6 @@ pub fn llty_str(&self, ty: Type) -> String {
         self.ccx().tn().type_to_string(ty)
     }
 
-    pub fn ty_to_string(&self, t: Ty<'tcx>) -> String {
-        t.repr()
-    }
-
     pub fn to_str(&self) -> String {
         format!("[block {:p}]", self)
     }
@@ -994,14 +985,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());
+            info!("Cache hit: {:?}", trait_ref);
             return (*vtable).clone();
         }
         None => { }
     }
 
-    debug!("trans fulfill_obligation: trait_ref={} def_id={:?}",
-           trait_ref.repr(), trait_ref.def_id());
+    debug!("trans fulfill_obligation: trait_ref={:?} def_id={:?}",
+           trait_ref, trait_ref.def_id());
 
     ty::populate_implementations_for_trait_if_necessary(tcx, trait_ref.def_id());
     let infcx = infer::new_infer_ctxt(tcx);
@@ -1022,9 +1013,9 @@ pub fn fulfill_obligation<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
             // leading to an ambiguous result. So report this as an
             // overflow bug, since I believe this is the only case
             // where ambiguity can result.
-            debug!("Encountered ambiguity selecting `{}` during trans, \
+            debug!("Encountered ambiguity selecting `{:?}` during trans, \
                     presuming due to overflow",
-                   trait_ref.repr());
+                   trait_ref);
             ccx.sess().span_fatal(
                 span,
                 "reached the recursion limit during monomorphization");
@@ -1032,9 +1023,9 @@ pub fn fulfill_obligation<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
         Err(e) => {
             tcx.sess.span_bug(
                 span,
-                &format!("Encountered error `{}` selecting `{}` during trans",
-                        e.repr(),
-                        trait_ref.repr()))
+                &format!("Encountered error `{:?}` selecting `{:?}` during trans",
+                        e,
+                        trait_ref))
         }
     };
 
@@ -1047,7 +1038,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());
+    info!("Cache miss: {:?}", trait_ref);
     ccx.trait_cache().borrow_mut().insert(trait_ref,
                                           vtable.clone());
 
@@ -1062,8 +1053,8 @@ pub fn normalize_and_test_predicates<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
                                                predicates: Vec<ty::Predicate<'tcx>>)
                                                -> bool
 {
-    debug!("normalize_and_test_predicates(predicates={})",
-           predicates.repr());
+    debug!("normalize_and_test_predicates(predicates={:?})",
+           predicates);
 
     let tcx = ccx.tcx();
     let infcx = infer::new_infer_ctxt(tcx);
@@ -1142,8 +1133,8 @@ pub fn drain_fulfillment_cx_or_panic<'a,'tcx,T>(span: Span,
         Err(errors) => {
             infcx.tcx.sess.span_bug(
                 span,
-                &format!("Encountered errors `{}` fulfilling during trans",
-                         errors.repr()));
+                &format!("Encountered errors `{:?}` fulfilling during trans",
+                         errors));
         }
     }
 }
@@ -1161,8 +1152,8 @@ pub fn drain_fulfillment_cx<'a,'tcx,T>(infcx: &infer::InferCtxt<'a,'tcx>,
                                        -> StdResult<T,Vec<traits::FulfillmentError<'tcx>>>
     where T : TypeFoldable<'tcx>
 {
-    debug!("drain_fulfillment_cx(result={})",
-           result.repr());
+    debug!("drain_fulfillment_cx(result={:?})",
+           result);
 
     // In principle, we only need to do this so long as `result`
     // contains unbound type parameters. It could be a slight
@@ -1210,7 +1201,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()));
+                                 node, substs));
         }
 
         monomorphize::apply_param_substs(tcx,
index 09f5509c5ac903262efe027c6bee0e6af53d0623..ad6358e057367fbf270a65f8d5a580a4144717e8 100644 (file)
@@ -32,7 +32,6 @@
 use middle::cast::{CastTy,IntTy};
 use middle::subst::Substs;
 use middle::ty::{self, Ty};
-use util::ppaux::Repr;
 use util::nodemap::NodeMap;
 
 use std::iter::repeat;
@@ -66,9 +65,9 @@ pub fn const_lit(cx: &CrateContext, e: &ast::Expr, lit: &ast::Lit)
                     C_integral(Type::uint_from_ty(cx, t), i as u64, false)
                 }
                 _ => cx.sess().span_bug(lit.span,
-                        &format!("integer literal has type {} (expected int \
+                        &format!("integer literal has type {:?} (expected int \
                                  or usize)",
-                                lit_int_ty.repr()))
+                                lit_int_ty))
             }
         }
         ast::LitFloat(ref fs, t) => {
@@ -160,8 +159,8 @@ fn const_deref<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
             }
         }
         None => {
-            cx.sess().bug(&format!("unexpected dereferenceable type {}",
-                                   ty.repr()))
+            cx.sess().bug(&format!("unexpected dereferenceable type {:?}",
+                                   ty))
         }
     }
 }
@@ -368,8 +367,8 @@ pub fn const_expr<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
             llvm::LLVMDumpValue(llconst);
             llvm::LLVMDumpValue(C_undef(llty));
         }
-        cx.sess().bug(&format!("const {} of type {} has size {} instead of {}",
-                         e.repr(), ety_adjusted.repr(),
+        cx.sess().bug(&format!("const {:?} of type {:?} has size {} instead of {}",
+                         e, ety_adjusted,
                          csize, tsize));
     }
     (llconst, ety_adjusted)
@@ -476,10 +475,10 @@ fn const_expr_unadjusted<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
                                    fn_args: FnArgMap)
                                    -> ValueRef
 {
-    debug!("const_expr_unadjusted(e={}, ety={}, param_substs={})",
-           e.repr(),
-           ety.repr(),
-           param_substs.repr());
+    debug!("const_expr_unadjusted(e={:?}, ety={:?}, param_substs={:?})",
+           e,
+           ety,
+           param_substs);
 
     let map_list = |exprs: &[P<ast::Expr>]| -> Vec<ValueRef> {
         exprs.iter()
@@ -496,9 +495,9 @@ fn const_expr_unadjusted<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
             /* Neither type is bottom, and we expect them to be unified
              * already, so the following is safe. */
             let (te1, ty) = const_expr(cx, &**e1, param_substs, fn_args);
-            debug!("const_expr_unadjusted: te1={}, ty={}",
+            debug!("const_expr_unadjusted: te1={}, ty={:?}",
                    cx.tn().val_to_string(te1),
-                   ty.repr());
+                   ty);
             let is_simd = ty::type_is_simd(cx.tcx(), ty);
             let intype = if is_simd {
                 ty::simd_type(cx.tcx(), ty)
@@ -620,13 +619,13 @@ 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()))
+                                                       or string type, found {:?}",
+                                                      bt))
                   },
                   _ => cx.sess().span_bug(base.span,
                                           &format!("index-expr base must be a vector \
-                                                   or string type, found {}",
-                                                  bt.repr()))
+                                                   or string type, found {:?}",
+                                                  bt))
               };
 
               let len = llvm::LLVMConstIntGetZExtValue(len) as u64;
@@ -654,7 +653,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(), t_cast.repr());
+            debug!("trans_const_cast({:?} as {:?})", t_expr, t_cast);
             if expr::cast_is_noop(cx.tcx(), base, t_expr, t_cast) {
                 return v;
             }
index ab76942ceee4b4e30db67de0d9ccdd10725ae99b..0ae69682f914ac591276604014a3ec698dea5ebf 100644 (file)
@@ -28,7 +28,6 @@
 use middle::ty::{self, Ty};
 use session::config::NoDebugInfo;
 use session::Session;
-use util::ppaux::Repr;
 use util::sha2::Sha256;
 use util::nodemap::{NodeMap, NodeSet, DefIdMap, FnvHashMap, FnvHashSet};
 
@@ -766,8 +765,8 @@ 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()))
+            &format!("the type `{:?}` is too big for the current architecture",
+                    obj))
     }
 
     pub fn check_overflow(&self) -> bool {
index b2cd99fc3ca89321202bb5598113d90a471cff90..ceef07207acb837f92a38ea58a66027d63156d4e 100644 (file)
@@ -24,7 +24,6 @@
 use trans::expr;
 use trans;
 use middle::ty;
-use util::ppaux::Repr;
 
 use syntax::ast;
 use syntax::ast_util;
@@ -36,14 +35,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());
+    debug!("trans_stmt({:?})", s);
 
     if cx.unreachable.get() {
         return cx;
     }
 
     if cx.sess().asm_comments() {
-        add_span_comment(cx, s.span, &s.repr());
+        add_span_comment(cx, s.span, &format!("{:?}", s));
     }
 
     let mut bcx = cx;
@@ -151,8 +150,8 @@ pub fn trans_if<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
                             els: Option<&ast::Expr>,
                             dest: expr::Dest)
                             -> Block<'blk, 'tcx> {
-    debug!("trans_if(bcx={}, if_id={}, cond={}, thn={}, dest={})",
-           bcx.to_str(), if_id, bcx.expr_to_string(cond), thn.id,
+    debug!("trans_if(bcx={}, if_id={}, cond={:?}, thn={}, dest={})",
+           bcx.to_str(), if_id, cond, thn.id,
            dest.to_string(bcx.ccx()));
     let _icx = push_ctxt("trans_if");
 
index e6b47fdee7eec16a3246d6015f401bda79e8bdaf..e60e4e4abe05336712dda9d90333015cb4a68833 100644 (file)
 use trans::tvec;
 use trans::type_of;
 use middle::ty::{self, Ty};
-use util::ppaux::Repr;
 
 use std::fmt;
 use syntax::ast;
@@ -614,9 +613,9 @@ pub fn shallow_copy<'blk>(&self,
 
     #[allow(dead_code)] // useful for debugging
     pub fn to_string<'a>(&self, ccx: &CrateContext<'a, 'tcx>) -> String {
-        format!("Datum({}, {}, {:?})",
+        format!("Datum({}, {:?}, {:?})",
                 ccx.tn().val_to_string(self.val),
-                self.ty.repr(),
+                self.ty,
                 self.kind)
     }
 
index 5ced8452b5f7060cf583738763f2c89e07fdde10..7660f59e1d08b0061bd79a92b0164083f8354cbe 100644 (file)
@@ -34,7 +34,6 @@
 use middle::ty::{self, Ty, ClosureTyper};
 use session::config::{self, FullDebugInfo};
 use util::nodemap::FnvHashMap;
-use util::ppaux::{Repr, UserString};
 use util::common::path2cstr;
 
 use libc::{c_uint, c_longlong};
@@ -105,7 +104,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()));
+                                   type_));
         }
     }
 
@@ -297,8 +296,8 @@ fn get_unique_type_id_of_type<'a>(&mut self, cx: &CrateContext<'a, 'tcx>,
                                                         &mut unique_type_id);
             },
             _ => {
-                cx.sess().bug(&format!("get_unique_type_id_of_type() - unexpected type: {}, {:?}",
-                                       type_.repr(), type_.sty))
+                cx.sess().bug(&format!("get_unique_type_id_of_type() - unexpected type: {:?}",
+                                       type_))
             }
         };
 
@@ -488,8 +487,8 @@ fn finalize<'a>(&self, cx: &CrateContext<'a, 'tcx>) -> MetadataCreationResult {
                     if type_map.find_metadata_for_unique_id(unique_type_id).is_none() ||
                        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())
+                                              '{:?}' was not found in TypeMap!",
+                                              unfinished_type)
                                       );
                     }
                 }
@@ -676,8 +675,8 @@ fn trait_pointer_metadata<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
         ty::TyTrait(ref data) => data.principal_def_id(),
         _ => {
             cx.sess().bug(&format!("debuginfo: Unexpected trait-object type in \
-                                   trait_pointer_metadata(): {}",
-                                   trait_type.repr()));
+                                   trait_pointer_metadata(): {:?}",
+                                   trait_type));
         }
     };
 
@@ -839,7 +838,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());
+                                                t);
                     cx.sess().span_bug(usage_site_span, &error_message[..]);
                 }
             };
@@ -854,7 +853,7 @@ pub fn type_metadata<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
                                                      debuginfo::TypeMap. \
                                                      UniqueTypeId={}, Ty={}",
                             &unique_type_id_str[..],
-                            t.user_string());
+                            t);
                         cx.sess().span_bug(usage_site_span, &error_message[..]);
                     }
                 }
index e33f059a94554458d806369dcee53657e319d058..5ba5ecb02c024c1b9f51cd63d0b78fc77bf527df 100644 (file)
@@ -15,7 +15,6 @@
 use trans::common::CrateContext;
 use middle::subst::{self, Substs};
 use middle::ty::{self, Ty, ClosureTyper};
-use util::ppaux::Repr;
 
 use syntax::ast;
 use syntax::parse::token;
@@ -163,7 +162,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()));
+                unexpected type: {:?}", t));
         }
     }
 
index 56daf7d570f21df677486c2a2379e4e71b8af61b..8bc3326d30093ea598f9b11f0ed6dcde339faf5f 100644 (file)
@@ -29,7 +29,6 @@
 use trans::monomorphize;
 use trans::type_::Type;
 use trans::type_of;
-use util::ppaux::Repr;
 
 use std::ffi::CString;
 use libc::c_uint;
@@ -106,11 +105,11 @@ pub fn declare_cfn(ccx: &CrateContext, name: &str, fn_type: Type,
 /// update the declaration and return existing ValueRef instead.
 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());
+    debug!("declare_rust_fn(name={:?}, fn_type={:?})", name,
+           fn_type);
     let fn_type = monomorphize::normalize_associated_type(ccx.tcx(), &fn_type);
-    debug!("declare_rust_fn (after normalised associated types) fn_type={}",
-           fn_type.repr());
+    debug!("declare_rust_fn (after normalised associated types) fn_type={:?}",
+           fn_type);
 
     let function_type; // placeholder so that the memory ownership works out ok
     let (sig, abi, env) = match fn_type.sty {
@@ -122,15 +121,15 @@ pub fn declare_rust_fn<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, name: &str,
             function_type = typer.closure_type(closure_did, substs);
             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(), self_type.repr());
+            debug!("declare_rust_fn function_type={:?} self_type={:?}",
+                   function_type, self_type);
             (&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());
+    debug!("declare_rust_fn (after region erasure) sig={:?}", sig);
     let llfty = type_of::type_of_rust_fn(ccx, env, &sig, abi);
     debug!("declare_rust_fn llfty={}", ccx.tn().type_to_string(llfty));
 
index 5a75a595b5c2114d5d6d36b3bfd266aed01bdb66..48deceeeef73f5b839b56d2f56c5cb72b21ac11b 100644 (file)
@@ -78,7 +78,6 @@
 use middle::ty::{self, Ty};
 use middle::ty::MethodCall;
 use util::common::indenter;
-use util::ppaux::Repr;
 use trans::machine::{llsize_of, llsize_of_alloc};
 use trans::type_::Type;
 
@@ -181,7 +180,7 @@ pub fn trans_into<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
         }
     }
 
-    debug!("trans_into() expr={}", expr.repr());
+    debug!("trans_into() expr={:?}", expr);
 
     let cleanup_debug_loc = debuginfo::get_cleanup_debug_loc_for_ast_node(bcx.ccx(),
                                                                           expr.id,
@@ -211,7 +210,7 @@ pub fn trans_into<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
 pub fn trans<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
                          expr: &ast::Expr)
                          -> DatumBlock<'blk, 'tcx, Expr> {
-    debug!("trans(expr={})", bcx.expr_to_string(expr));
+    debug!("trans(expr={:?})", expr);
 
     let mut bcx = bcx;
     let fcx = bcx.fcx;
@@ -329,9 +328,9 @@ pub fn unsized_info<'ccx, 'tcx>(ccx: &CrateContext<'ccx, 'tcx>,
             consts::ptrcast(meth::get_vtable(ccx, trait_ref, param_substs),
                             Type::vtable_ptr(ccx))
         }
-        _ => ccx.sess().bug(&format!("unsized_info: invalid unsizing {} -> {}",
-                                     source.repr(),
-                                     target.repr()))
+        _ => ccx.sess().bug(&format!("unsized_info: invalid unsizing {:?} -> {:?}",
+                                     source,
+                                     target))
     }
 }
 
@@ -350,8 +349,8 @@ fn apply_adjustments<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
         }
         Some(adj) => { adj }
     };
-    debug!("unadjusted datum for expr {}: {} adjustment={:?}",
-           expr.repr(),
+    debug!("unadjusted datum for expr {:?}: {} adjustment={:?}",
+           expr,
            datum.to_string(bcx.ccx()),
            adjustment);
     match adjustment {
@@ -501,8 +500,8 @@ fn coerce_unsized<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
                     ty::custom_coerce_unsized_kind(bcx.tcx(), impl_def_id)
                 }
                 vtable => {
-                    bcx.sess().span_bug(span, &format!("invalid CoerceUnsized vtable: {}",
-                                                       vtable.repr()));
+                    bcx.sess().span_bug(span, &format!("invalid CoerceUnsized vtable: {:?}",
+                                                       vtable));
                 }
             };
 
@@ -545,9 +544,9 @@ fn coerce_unsized<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
                 }
             }
         }
-        _ => bcx.sess().bug(&format!("coerce_unsized: invalid coercion {} -> {}",
-                                     source.ty.repr(),
-                                     target.ty.repr()))
+        _ => bcx.sess().bug(&format!("coerce_unsized: invalid coercion {:?} -> {:?}",
+                                     source.ty,
+                                     target.ty))
     }
     bcx
 }
@@ -575,7 +574,7 @@ fn trans_unadjusted<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
                                 -> DatumBlock<'blk, 'tcx, Expr> {
     let mut bcx = bcx;
 
-    debug!("trans_unadjusted(expr={})", bcx.expr_to_string(expr));
+    debug!("trans_unadjusted(expr={:?})", expr);
     let _indenter = indenter();
 
     debuginfo::set_source_location(bcx.fcx, expr.id, expr.span);
@@ -1281,9 +1280,9 @@ 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 {}",
+                    "trans_def_fn_unadjusted invoked on: {:?} for {:?}",
                     def,
-                    ref_expr.repr()));
+                    ref_expr));
         }
     }
 }
@@ -1317,7 +1316,7 @@ pub fn trans_local_var<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
                 }
             };
             debug!("take_local(nid={}, v={}, ty={})",
-                   nid, bcx.val_to_string(datum.val), bcx.ty_to_string(datum.ty));
+                   nid, bcx.val_to_string(datum.val), datum.ty);
             datum
         }
         _ => {
@@ -1354,9 +1353,9 @@ pub fn with_field_tys<'tcx, R, F>(tcx: &ty::ctxt<'tcx>,
             match node_id_opt {
                 None => {
                     tcx.sess.bug(&format!(
-                        "cannot get field types from the enum type {} \
+                        "cannot get field types from the enum type {:?} \
                          without a node ID",
-                        ty.repr()));
+                        ty));
                 }
                 Some(node_id) => {
                     let def = tcx.def_map.borrow().get(&node_id).unwrap().full_def();
@@ -1378,8 +1377,8 @@ 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()));
+                "cannot get field types from the type {:?}",
+                ty));
         }
     }
 }
@@ -2060,7 +2059,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(), t_out.repr());
+    debug!("trans_cast({:?} as {:?})", t_in, t_out);
     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
@@ -2123,9 +2122,9 @@ fn float_cast(bcx: Block,
 
         _ => ccx.sess().span_bug(expr.span,
                                   &format!("translating unsupported cast: \
-                                            {} -> {}",
-                                           t_in.repr(),
-                                           t_out.repr())
+                                            {:?} -> {:?}",
+                                           t_in,
+                                           t_out)
                                  )
     };
     return immediate_rvalue_bcx(bcx, newval, t_out).to_expr_datumblock();
@@ -2140,7 +2139,7 @@ fn trans_assign_op<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
     let _icx = push_ctxt("trans_assign_op");
     let mut bcx = bcx;
 
-    debug!("trans_assign_op(expr={})", bcx.expr_to_string(expr));
+    debug!("trans_assign_op(expr={:?})", expr);
 
     // User-defined operator methods cannot be used with `+=` etc right now
     assert!(!bcx.tcx().method_map.borrow().contains_key(&MethodCall::expr(expr.id)));
@@ -2210,8 +2209,8 @@ fn deref_once<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
                           -> DatumBlock<'blk, 'tcx, Expr> {
     let ccx = bcx.ccx();
 
-    debug!("deref_once(expr={}, datum={}, method_call={:?})",
-           expr.repr(),
+    debug!("deref_once(expr={:?}, datum={}, method_call={:?})",
+           expr,
            datum.to_string(ccx),
            method_call);
 
@@ -2295,8 +2294,8 @@ 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()));
+                &format!("deref invoked on expr of illegal type {:?}",
+                        datum.ty));
         }
     };
 
index 66f7a89d7abb27853edf64b031936eaf3b6d45b3..977d636d253e4cee7053ca35e257e1c84b68edd3 100644 (file)
@@ -40,7 +40,6 @@
 use syntax::ast;
 use syntax::attr;
 use syntax::print::pprust;
-use util::ppaux::Repr;
 
 ///////////////////////////////////////////////////////////////////////////
 // Type definitions
@@ -183,11 +182,11 @@ pub fn get_extern_fn(ccx: &CrateContext,
 pub fn register_foreign_item_fn<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
                                           abi: Abi, fty: Ty<'tcx>,
                                           name: &str) -> ValueRef {
-    debug!("register_foreign_item_fn(abi={}, \
-            ty={}, \
+    debug!("register_foreign_item_fn(abi={:?}, \
+            ty={:?}, \
             name={})",
-           abi.repr(),
-           fty.repr(),
+           abi,
+           fty,
            name);
 
     let cc = llvm_calling_convention(ccx, abi);
@@ -234,10 +233,10 @@ pub fn trans_native_call<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
 {
     let ccx = bcx.ccx();
 
-    debug!("trans_native_call(callee_ty={}, \
+    debug!("trans_native_call(callee_ty={:?}, \
             llfn={}, \
             llretptr={})",
-           callee_ty.repr(),
+           callee_ty,
            ccx.tn().val_to_string(llfn),
            ccx.tn().val_to_string(llretptr));
 
@@ -609,16 +608,16 @@ fn build_rust_fn<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
                 assert!(f.abi != Rust && f.abi != RustIntrinsic);
             }
             _ => {
-                ccx.sess().bug(&format!("build_rust_fn: extern fn {} has ty {}, \
+                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()));
+                                       t));
             }
         };
 
-        debug!("build_rust_fn: path={} id={} t={}",
+        debug!("build_rust_fn: path={} id={} t={:?}",
                ccx.tcx().map.path_to_string(id),
-               id, t.repr());
+               id, t);
 
         let llfn = declare::define_internal_rust_fn(ccx, &ps[..], t).unwrap_or_else(||{
             ccx.sess().bug(&format!("symbol `{}` already defined", ps));
@@ -636,10 +635,10 @@ unsafe fn build_wrap_fn<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
         let _icx = push_ctxt(
             "foreign::trans_rust_fn_with_foreign_abi::build_wrap_fn");
 
-        debug!("build_wrap_fn(llrustfn={}, llwrapfn={}, t={})",
+        debug!("build_wrap_fn(llrustfn={}, llwrapfn={}, t={:?})",
                ccx.tn().val_to_string(llrustfn),
                ccx.tn().val_to_string(llwrapfn),
-               t.repr());
+               t);
 
         // Avoid all the Rust generation stuff and just generate raw
         // LLVM here.
@@ -721,10 +720,10 @@ unsafe fn build_wrap_fn<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
                     debug!("out pointer, \
                             allocad={}, \
                             llrust_ret_ty={}, \
-                            return_ty={}",
+                            return_ty={:?}",
                            ccx.tn().val_to_string(slot),
                            ccx.tn().type_to_string(llrust_ret_ty),
-                           tys.fn_sig.output.repr());
+                           tys.fn_sig.output);
                     llrust_args.push(slot);
                     return_alloca = Some(slot);
                 }
@@ -815,8 +814,8 @@ 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());
+        debug!("calling llrustfn = {}, t = {:?}",
+               ccx.tn().val_to_string(llrustfn), t);
         let attributes = attributes::from_fn_type(ccx, t);
         let llrust_ret_val = builder.call(llrustfn, &llrust_args, Some(attributes));
 
@@ -934,11 +933,11 @@ fn foreign_types_for_fn_ty<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
                                        llsig.llret_ty,
                                        llsig.ret_def);
     debug!("foreign_types_for_fn_ty(\
-           ty={}, \
+           ty={:?}, \
            llsig={} -> {}, \
            fn_ty={} -> {}, \
            ret_def={}",
-           ty.repr(),
+           ty,
            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 e0ac4391d67d1ea1a17d9c1c55ec39b49986f098..6caf00634b63aa65b6fb7d4e487b5da47287ab47 100644 (file)
@@ -39,7 +39,6 @@
 use trans::monomorphize;
 use trans::type_of::{type_of, type_of_dtor, sizing_type_of, align_of};
 use trans::type_::Type;
-use util::ppaux::Repr;
 
 use arena::TypedArena;
 use libc::c_uint;
@@ -140,7 +139,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(), skip_dtor);
+    debug!("drop_ty_core(t={:?}, skip_dtor={})", t, skip_dtor);
     let _icx = push_ctxt("drop_ty");
     if bcx.fcx.type_needs_drop(t) {
         let ccx = bcx.ccx();
@@ -207,9 +206,9 @@ fn map_ty<F>(&self, mut f: F) -> DropGlueKind<'tcx> where F: FnMut(Ty<'tcx>) ->
 
 fn get_drop_glue_core<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
                                 g: DropGlueKind<'tcx>) -> ValueRef {
-    debug!("make drop glue for {}", g.repr());
+    debug!("make drop glue for {:?}", g);
     let g = g.map_ty(|t| get_drop_glue_type(ccx, t));
-    debug!("drop glue type {}", g.repr());
+    debug!("drop glue type {:?}", g);
     match ccx.drop_glues().borrow().get(&g) {
         Some(&glue) => return glue,
         _ => { }
@@ -238,7 +237,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()));
+    let _s = StatRecorder::new(ccx, format!("drop {:?}", t));
 
     let empty_substs = ccx.tcx().mk_substs(Substs::trans_empty());
     let (arena, fcx): (TypedArena<_>, FunctionContext);
@@ -346,7 +345,7 @@ fn trans_struct_drop<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
                                  substs: &subst::Substs<'tcx>)
                                  -> Block<'blk, 'tcx>
 {
-    debug!("trans_struct_drop t: {}", bcx.ty_to_string(t));
+    debug!("trans_struct_drop t: {}", t);
 
     // Find and call the actual destructor
     let dtor_addr = get_res_dtor(bcx.ccx(), dtor_did, t, class_did, substs);
@@ -381,7 +380,7 @@ fn trans_struct_drop<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
 pub fn size_and_align_of_dst<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, t: Ty<'tcx>, info: ValueRef)
                                          -> (ValueRef, ValueRef) {
     debug!("calculate size of DST: {}; with lost info: {}",
-           bcx.ty_to_string(t), bcx.val_to_string(info));
+           t, bcx.val_to_string(info));
     if type_is_sized(bcx.tcx(), t) {
         let sizing_type = sizing_type_of(bcx.ccx(), t);
         let size = C_uint(bcx.ccx(), llsize_of_alloc(bcx.ccx(), sizing_type));
@@ -436,8 +435,7 @@ pub fn size_and_align_of_dst<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, t: Ty<'tcx>, in
             (Mul(bcx, info, C_uint(bcx.ccx(), unit_size), DebugLoc::None),
              C_uint(bcx.ccx(), unit_align))
         }
-        _ => bcx.sess().bug(&format!("Unexpected unsized type, found {}",
-                                    bcx.ty_to_string(t)))
+        _ => bcx.sess().bug(&format!("Unexpected unsized type, found {}", t))
     }
 }
 
@@ -511,8 +509,7 @@ fn make_drop_glue<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, v0: ValueRef, g: DropGlueK
                         // stupid and dangerous.
                         bcx.sess().warn(&format!("Ignoring drop flag in destructor for {}\
                                                  because the struct is unsized. See issue\
-                                                 #16758",
-                                                bcx.ty_to_string(t)));
+                                                 #16758", t));
                         trans_struct_drop(bcx, t, v0, dtor, did, substs)
                     }
                 }
index c2b0d78ce1f88c588922d1e7dd4c136fd333770b..41d150ac265c93f6a278e0acd1c5033a450eb1df 100644 (file)
@@ -34,7 +34,6 @@
 use syntax::abi::RustIntrinsic;
 use syntax::ast;
 use syntax::parse::token;
-use util::ppaux::{Repr, UserString};
 
 pub fn get_simple_intrinsic(ccx: &CrateContext, item: &ast::ForeignItem) -> Option<ValueRef> {
     let name = match &token::get_ident(item.ident)[..] {
@@ -102,7 +101,7 @@ pub fn check_intrinsics(ccx: &CrateContext) {
             continue;
         }
 
-        debug!("transmute_restriction: {}", transmute_restriction.repr());
+        debug!("transmute_restriction: {:?}", transmute_restriction);
 
         assert!(!ty::type_has_params(transmute_restriction.substituted_from));
         assert!(!ty::type_has_params(transmute_restriction.substituted_to));
@@ -121,10 +120,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(),
+                             transmute_restriction.original_from,
                              from_type_size as usize,
                              if from_type_size == 1 {""} else {"s"},
-                             transmute_restriction.original_to.user_string(),
+                             transmute_restriction.original_to,
                              to_type_size as usize,
                              if to_type_size == 1 {""} else {"s"}));
             } else {
@@ -132,10 +131,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(),
+                             transmute_restriction.original_from,
                              from_type_size as usize,
                              if from_type_size == 1 {""} else {"s"},
-                             transmute_restriction.original_to.user_string(),
+                             transmute_restriction.original_to,
                              to_type_size as usize,
                              if to_type_size == 1 {""} else {"s"}));
             }
@@ -405,7 +404,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());
+            let ty_name = token::intern_and_get_ident(&tp_ty.to_string());
             C_str_slice(ccx, ty_name)
         }
         (_, "type_id") => {
index ec95bfe483c264dcf5e4ef475dfa2128e4e918aa..eca6eecff4279294d1d11d6dc5602be3ec69f8f7 100644 (file)
@@ -39,7 +39,6 @@
 use trans::type_of::*;
 use middle::ty::{self, Ty};
 use middle::ty::MethodCall;
-use util::ppaux::Repr;
 
 use syntax::abi::{Rust, RustCall};
 use syntax::parse::token;
@@ -136,15 +135,15 @@ pub fn trans_method_callee<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
         }) => {
             let trait_ref = ty::Binder(bcx.monomorphize(trait_ref));
             let span = bcx.tcx().map.span(method_call.expr_id);
-            debug!("method_call={:?} trait_ref={} trait_ref id={:?} substs={:?}",
+            debug!("method_call={:?} trait_ref={:?} trait_ref id={:?} substs={:?}",
                    method_call,
-                   trait_ref.repr(),
+                   trait_ref,
                    trait_ref.0.def_id,
                    trait_ref.0.substs);
             let origin = fulfill_obligation(bcx.ccx(),
                                             span,
                                             trait_ref.clone());
-            debug!("origin = {}", origin.repr());
+            debug!("origin = {:?}", origin);
             trans_monomorphized_callee(bcx,
                                        method_call,
                                        trait_ref.def_id(),
@@ -234,7 +233,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());
+    debug!("trait_substs={:?}", trait_substs);
     let trait_ref = ty::Binder(ty::TraitRef { def_id: trait_id,
                                               substs: trait_substs });
     let vtbl = fulfill_obligation(ccx,
@@ -296,8 +295,8 @@ pub fn trans_static_method_callee<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
             immediate_rvalue(llfn, ty)
         }
         _ => {
-            tcx.sess.bug(&format!("static call to invalid vtable: {}",
-                                 vtbl.repr()));
+            tcx.sess.bug(&format!("static call to invalid vtable: {:?}",
+                                 vtbl));
         }
     }
 }
@@ -390,8 +389,8 @@ fn trans_monomorphized_callee<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
         traits::VtableDefaultImpl(..) |
         traits::VtableParam(..) => {
             bcx.sess().bug(
-                &format!("resolved vtable bad vtable {} in trans",
-                        vtable.repr()));
+                &format!("resolved vtable bad vtable {:?} in trans",
+                        vtable));
         }
     }
 }
@@ -415,8 +414,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());
-    debug!("node_substs={}", node_substs.repr());
+    debug!("rcvr_substs={:?}", rcvr_substs);
+    debug!("node_substs={:?}", node_substs);
 
     // Break apart the type parameters from the node and type
     // parameters from the receiver.
@@ -484,7 +483,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(),
+           callee_ty,
            vtable_index,
            bcx.val_to_string(llpair));
     let llboxptr = GEPi(bcx, llpair, &[0, abi::FAT_PTR_ADDR]);
@@ -556,9 +555,9 @@ pub fn trans_object_shim<'a, 'tcx>(
     let tcx = ccx.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(),
-           upcast_trait_ref.repr(),
+    debug!("trans_object_shim(object_ty={:?}, upcast_trait_ref={:?}, method_offset_in_trait={})",
+           object_ty,
+           upcast_trait_ref,
            method_offset_in_trait);
 
     let object_trait_ref =
@@ -567,15 +566,15 @@ pub fn trans_object_shim<'a, 'tcx>(
                 data.principal_trait_ref_with_self_ty(tcx, object_ty)
             }
             _ => {
-                tcx.sess.bug(&format!("trans_object_shim() called on non-object: {}",
-                                      object_ty.repr()));
+                tcx.sess.bug(&format!("trans_object_shim() called on non-object: {:?}",
+                                      object_ty));
             }
         };
 
     // 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());
+    debug!("trans_object_shim: object_substs={:?}", object_substs);
 
     // 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 +586,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(), method_ty.repr());
+    debug!("trans_object_shim: fty={:?} method_ty={:?}", fty, method_ty);
 
     //
     let shim_fn_ty = ty::mk_bare_fn(tcx, None, fty);
@@ -627,8 +626,8 @@ pub fn trans_object_shim<'a, 'tcx>(
                     ty::TyTuple(ref tys) => &**tys,
                     _ => {
                         bcx.sess().bug(
-                            &format!("rust-call expects a tuple not {}",
-                                     sig.inputs[1].repr()));
+                            &format!("rust-call expects a tuple not {:?}",
+                                     sig.inputs[1]));
                     }
                 }
             }
@@ -692,7 +691,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());
+    debug!("get_vtable(trait_ref={:?})", trait_ref);
 
     // Check the cache.
     match ccx.vtables().borrow().get(&trait_ref) {
@@ -739,14 +738,14 @@ pub fn get_vtable<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
                 // an object type; this cannot happen because we
                 // cannot cast an unsized type into a trait object
                 tcx.sess.bug(
-                    &format!("cannot get vtable for an object type: {}",
-                            data.repr()));
+                    &format!("cannot get vtable for an object type: {:?}",
+                            data));
             }
             traits::VtableParam(..) => {
                 tcx.sess.bug(
-                    &format!("resolved vtable for {} to bad vtable {} in trans",
-                            trait_ref.repr(),
-                            vtable.repr()));
+                    &format!("resolved vtable for {:?} to bad vtable {:?} in trans",
+                            trait_ref,
+                            vtable));
             }
         }
     });
@@ -776,10 +775,10 @@ 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(),
-           substs.repr(),
-           param_substs.repr());
+    debug!("emit_vtable_methods(impl_id={:?}, substs={:?}, param_substs={:?})",
+           impl_id,
+           substs,
+           param_substs);
 
     let trt_id = match ty::impl_trait_ref(tcx, impl_id) {
         Some(t_id) => t_id.def_id,
@@ -806,8 +805,8 @@ fn emit_vtable_methods<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
         // method could never be called from this object, just supply
         // null.
         .map(|trait_method_def_id| {
-            debug!("emit_vtable_methods: trait_method_def_id={}",
-                   trait_method_def_id.repr());
+            debug!("emit_vtable_methods: trait_method_def_id={:?}",
+                   trait_method_def_id);
 
             let trait_method_type = match ty::impl_or_trait_item(tcx, trait_method_def_id) {
                 ty::MethodTraitItem(m) => m,
@@ -821,8 +820,8 @@ fn emit_vtable_methods<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
                 return nullptr;
             }
 
-            debug!("emit_vtable_methods: trait_method_type={}",
-                   trait_method_type.repr());
+            debug!("emit_vtable_methods: trait_method_type={:?}",
+                   trait_method_type);
 
             // The substitutions we have are on the impl, so we grab
             // the method type from the impl to substitute into.
@@ -832,8 +831,8 @@ fn emit_vtable_methods<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
                 _ => ccx.sess().bug("should be a method, not other assoc item"),
             };
 
-            debug!("emit_vtable_methods: impl_method_type={}",
-                   impl_method_type.repr());
+            debug!("emit_vtable_methods: impl_method_type={:?}",
+                   impl_method_type);
 
             // If this is a default method, it's possible that it
             // relies on where clauses that do not hold for this
index 4a81610dd852f9e006ac13fbf0f675fea19b9fff..f4bad313bafb1c95e2772b3655a6e8250d096a7d 100644 (file)
@@ -26,7 +26,6 @@
 use trans::declare;
 use trans::foreign;
 use middle::ty::{self, HasProjectionTypes, Ty};
-use util::ppaux::Repr;
 
 use syntax::abi;
 use syntax::ast;
@@ -41,11 +40,11 @@ pub fn monomorphic_fn<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
                                 ref_id: Option<ast::NodeId>)
     -> (ValueRef, Ty<'tcx>, bool) {
     debug!("monomorphic_fn(\
-            fn_id={}, \
-            real_substs={}, \
+            fn_id={:?}, \
+            real_substs={:?}, \
             ref_id={:?})",
-           fn_id.repr(),
-           psubsts.repr(),
+           fn_id,
+           psubsts,
            ref_id);
 
     assert!(psubsts.types.all(|t| {
@@ -61,7 +60,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());
+    debug!("monomorphic_fn about to subst into {:?}", item_ty);
     let mono_ty = item_ty.subst(ccx.tcx(), psubsts);
 
     match ccx.monomorphized().borrow().get(&hash_id) {
@@ -74,11 +73,11 @@ pub fn monomorphic_fn<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
     }
 
     debug!("monomorphic_fn(\
-            fn_id={}, \
-            psubsts={}, \
+            fn_id={:?}, \
+            psubsts={:?}, \
             hash_id={:?})",
-           fn_id.repr(),
-           psubsts.repr(),
+           fn_id,
+           psubsts,
            hash_id);
 
 
@@ -99,10 +98,10 @@ pub fn monomorphic_fn<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
         }
     }
 
-    debug!("mono_ty = {} (post-substitution)", mono_ty.repr());
+    debug!("mono_ty = {:?} (post-substitution)", mono_ty);
 
     let mono_ty = normalize_associated_type(ccx.tcx(), &mono_ty);
-    debug!("mono_ty = {} (post-normalization)", mono_ty.repr());
+    debug!("mono_ty = {:?} (post-normalization)", mono_ty);
 
     ccx.stats().n_monos.set(ccx.stats().n_monos.get() + 1);
 
@@ -316,7 +315,7 @@ pub fn apply_param_substs<'tcx,T>(tcx: &ty::ctxt<'tcx>,
 pub fn normalize_associated_type<'tcx,T>(tcx: &ty::ctxt<'tcx>, value: &T) -> T
     where T : TypeFoldable<'tcx> + HasProjectionTypes
 {
-    debug!("normalize_associated_type(t={})", value.repr());
+    debug!("normalize_associated_type(t={:?})", value);
 
     let value = erase_regions(tcx, value);
 
@@ -333,9 +332,9 @@ pub fn normalize_associated_type<'tcx,T>(tcx: &ty::ctxt<'tcx>, value: &T) -> T
     let traits::Normalized { value: result, obligations } =
         traits::normalize(&mut selcx, cause, &value);
 
-    debug!("normalize_associated_type: result={} obligations={}",
-           result.repr(),
-           obligations.repr());
+    debug!("normalize_associated_type: result={:?} obligations={:?}",
+           result,
+           obligations);
 
     let mut fulfill_cx = traits::FulfillmentContext::new(true);
     for obligation in obligations {
index f2168d38c9e57c631f0c9c82bb33d5bd752f35d3..bba0f6d26083a6d04e4fd1e7c72a7dd4c0540835 100644 (file)
@@ -28,7 +28,6 @@
 use trans::type_::Type;
 use trans::type_of;
 use middle::ty::{self, Ty};
-use util::ppaux::UserString;
 
 use syntax::ast;
 use syntax::parse::token::InternedString;
@@ -42,7 +41,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(),
+                self.unit_ty,
                 ccx.tn().type_to_string(self.llunit_ty))
     }
 }
@@ -58,8 +57,8 @@ pub fn trans_fixed_vstore<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
     // to store the array of the suitable size, so all we have to do is
     // generate the content.
 
-    debug!("trans_fixed_vstore(expr={}, dest={})",
-           bcx.expr_to_string(expr), dest.to_string(bcx.ccx()));
+    debug!("trans_fixed_vstore(expr={:?}, dest={})",
+           expr, dest.to_string(bcx.ccx()));
 
     let vt = vec_types_from_expr(bcx, expr);
 
@@ -85,8 +84,8 @@ pub fn trans_slice_vec<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
     let ccx = fcx.ccx;
     let mut bcx = bcx;
 
-    debug!("trans_slice_vec(slice_expr={})",
-           bcx.expr_to_string(slice_expr));
+    debug!("trans_slice_vec(slice_expr={:?})",
+           slice_expr);
 
     let vec_ty = node_id_type(bcx, slice_expr.id);
 
@@ -139,8 +138,8 @@ pub fn trans_lit_str<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
                                  str_lit: InternedString,
                                  dest: Dest)
                                  -> Block<'blk, 'tcx> {
-    debug!("trans_lit_str(lit_expr={}, dest={})",
-           bcx.expr_to_string(lit_expr),
+    debug!("trans_lit_str(lit_expr={:?}, dest={})",
+           lit_expr,
            dest.to_string(bcx.ccx()));
 
     match dest {
@@ -167,10 +166,10 @@ fn write_content<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
     let fcx = bcx.fcx;
     let mut bcx = bcx;
 
-    debug!("write_content(vt={}, dest={}, vstore_expr={})",
+    debug!("write_content(vt={}, dest={}, vstore_expr={:?})",
            vt.to_string(bcx.ccx()),
            dest.to_string(bcx.ccx()),
-           bcx.expr_to_string(vstore_expr));
+           vstore_expr);
 
     match content_expr.node {
         ast::ExprLit(ref lit) => {
index 4ec6edcea714db5dcd9dab86c44f0930c18a25ff..26b54142d63160b403736cda7bd4a8c673698869 100644 (file)
@@ -16,7 +16,6 @@
 use trans::foreign;
 use trans::machine;
 use middle::ty::{self, RegionEscape, Ty};
-use util::ppaux::Repr;
 
 use trans::type_::Type;
 
@@ -99,8 +98,8 @@ pub fn type_of_rust_fn<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
                                  abi: abi::Abi)
                                  -> Type
 {
-    debug!("type_of_rust_fn(sig={},abi={:?})",
-           sig.repr(),
+    debug!("type_of_rust_fn(sig={:?},abi={:?})",
+           sig,
            abi);
 
     let sig = ty::erase_late_bound_regions(cx.tcx(), sig);
@@ -228,8 +227,8 @@ 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.sess().bug(&format!("fictitious type {:?} in sizing_type_of()",
+                                   t))
         }
         ty::TySlice(_) | ty::TyTrait(..) | ty::TyStr => unreachable!()
     };
@@ -298,7 +297,7 @@ pub fn in_memory_type_of<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>, t: Ty<'tcx>) ->
         None => ()
     }
 
-    debug!("type_of {} {:?}", t.repr(), t.sty);
+    debug!("type_of {:?}", t);
 
     assert!(!t.has_escaping_regions());
 
@@ -311,10 +310,10 @@ 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(),
+        debug!("--> normalized {:?} {:?} to {:?} {:?} llty={}",
                 t,
-                t_norm.repr(),
+                t,
+                t_norm,
                 t_norm,
                 cx.tn().type_to_string(llty));
         cx.lltypes().borrow_mut().insert(t, llty);
@@ -363,8 +362,8 @@ 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(), ty.repr())
+                                   struct_tail: {:?} for ty={:?}",
+                                  unsized_part, ty)
                   };
                   Type::struct_(cx, &[ptr_ty, info_ty], false)
               }
@@ -418,8 +417,8 @@ pub fn in_memory_type_of<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>, t: Ty<'tcx>) ->
       ty::TyError(..) => cx.sess().bug("type_of with TyError"),
     };
 
-    debug!("--> mapped t={} {:?} to llty={}",
-            t.repr(),
+    debug!("--> mapped t={:?} {:?} to llty={}",
+            t,
             t,
             cx.tn().type_to_string(llty));
 
@@ -449,7 +448,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()).collect();
+    let strings: Vec<String> = tps.iter().map(|t| t.to_string()).collect();
     let tstr = if strings.is_empty() {
         base
     } else {
index dee8eefd9da5fa2dd26b106cb1a931519af3c0dc..8e838d991fbe7df35e1d28b0b6dca4ddb693ec5d 100644 (file)
@@ -61,7 +61,6 @@
              ObjectLifetimeDefaultRscope, ShiftedRscope, BindingRscope};
 use util::common::{ErrorReported, FN_OUTPUT_NAME};
 use util::nodemap::FnvHashSet;
-use util::ppaux::{Repr, UserString};
 
 use std::iter::repeat;
 use std::slice;
@@ -178,10 +177,10 @@ pub fn ast_region_to_region(tcx: &ty::ctxt, lifetime: &ast::Lifetime)
         }
     };
 
-    debug!("ast_region_to_region(lifetime={} id={}) yields {}",
-           lifetime.repr(),
+    debug!("ast_region_to_region(lifetime={:?} id={}) yields {:?}",
+           lifetime,
            lifetime.id,
-           r.repr());
+           r);
 
     r
 }
@@ -256,9 +255,9 @@ pub fn opt_ast_region_to_region<'tcx>(
         }
     };
 
-    debug!("opt_ast_region_to_region(opt_lifetime={}) yields {}",
-            opt_lifetime.repr(),
-            r.repr());
+    debug!("opt_ast_region_to_region(opt_lifetime={:?}) yields {:?}",
+            opt_lifetime,
+            r);
 
     r
 }
@@ -373,10 +372,10 @@ fn create_substs_for_ast_path<'tcx>(
 {
     let tcx = this.tcx();
 
-    debug!("create_substs_for_ast_path(decl_generics={}, self_ty={}, \
-           types_provided={}, region_substs={}",
-           decl_generics.repr(), self_ty.repr(), types_provided.repr(),
-           region_substs.repr());
+    debug!("create_substs_for_ast_path(decl_generics={:?}, self_ty={:?}, \
+           types_provided={:?}, region_substs={:?}",
+           decl_generics, self_ty, types_provided,
+           region_substs);
 
     assert_eq!(region_substs.regions().len(TypeSpace), decl_generics.regions.len(TypeSpace));
     assert!(region_substs.types.is_empty());
@@ -441,8 +440,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(),
-                          default.user_string());
+                          param.name,
+                          default);
                 substs.types.push(TypeSpace, tcx.types.err);
             } else {
                 // This is a default type parameter.
@@ -649,7 +648,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());
+                        path);
         }
     }
 }
@@ -879,7 +878,7 @@ fn ast_type_binding_to_poly_projection_predicate<'tcx>(
 
     let candidate = try!(one_bound_for_assoc_type(tcx,
                                                   candidates,
-                                                  &trait_ref.user_string(),
+                                                  &trait_ref.to_string(),
                                                   &token::get_name(binding.item_name),
                                                   binding.span));
 
@@ -1030,8 +1029,8 @@ fn trait_ref_to_object_type<'tcx>(this: &AstConv<'tcx>,
                                                      bounds);
 
     let result = make_object_type(this, span, trait_ref, existential_bounds);
-    debug!("trait_ref_to_object_type: result={}",
-           result.repr());
+    debug!("trait_ref_to_object_type: result={:?}",
+           result);
 
     result
 }
@@ -1074,7 +1073,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(),
+                    name,
                     ty::item_path_str(tcx, trait_def_id));
     }
 
@@ -1160,7 +1159,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());
+                       bound);
         }
     }
 
@@ -1183,7 +1182,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(), token::get_name(assoc_name));
+    debug!("associated_path_def_to_ty: {:?}::{}", ty, assoc_name);
 
     check_path_args(tcx, slice::ref_slice(item_segment), NO_TPS | NO_REGIONS);
 
@@ -1239,7 +1238,7 @@ fn associated_path_def_to_ty<'tcx>(this: &AstConv<'tcx>,
         _ => {
             report_ambiguous_associated_type(tcx,
                                              span,
-                                             &ty.user_string(),
+                                             &ty.to_string(),
                                              "Trait",
                                              &token::get_name(assoc_name));
             return (tcx.types.err, ty_path_def);
@@ -1296,7 +1295,7 @@ fn qpath_to_ty<'tcx>(this: &AstConv<'tcx>,
         return tcx.types.err;
     };
 
-    debug!("qpath_to_ty: self_type={}", self_ty.repr());
+    debug!("qpath_to_ty: self_type={:?}", self_ty);
 
     let trait_ref = ast_path_to_mono_trait_ref(this,
                                                rscope,
@@ -1306,7 +1305,7 @@ fn qpath_to_ty<'tcx>(this: &AstConv<'tcx>,
                                                Some(self_ty),
                                                trait_segment);
 
-    debug!("qpath_to_ty: trait_ref={}", trait_ref.repr());
+    debug!("qpath_to_ty: trait_ref={:?}", trait_ref);
 
     this.projected_ty(span, trait_ref, item_segment.identifier.name)
 }
@@ -1495,8 +1494,8 @@ pub fn ast_ty_to_ty<'tcx>(this: &AstConv<'tcx>,
                           ast_ty: &ast::Ty)
                           -> Ty<'tcx>
 {
-    debug!("ast_ty_to_ty(ast_ty={})",
-           ast_ty.repr());
+    debug!("ast_ty_to_ty(ast_ty={:?})",
+           ast_ty);
 
     let tcx = this.tcx();
 
@@ -1531,7 +1530,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());
+            debug!("TyRef r={:?}", r);
             let rscope1 =
                 &ObjectLifetimeDefaultRscope::new(
                     rscope,
@@ -1568,8 +1567,7 @@ pub fn ast_ty_to_ty<'tcx>(this: &AstConv<'tcx>,
                     depth: path.segments.len()
                 }
             } else {
-                tcx.sess.span_bug(ast_ty.span,
-                                  &format!("unbound path {}", ast_ty.repr()))
+                tcx.sess.span_bug(ast_ty.span, &format!("unbound path {:?}", ast_ty))
             };
             let def = path_res.base_def;
             let base_ty_end = path.segments.len() - path_res.depth;
@@ -1843,11 +1841,11 @@ fn determine_explicit_self_category<'a, 'tcx>(this: &AstConv<'tcx>,
             let impl_modifiers = count_modifiers(self_info.untransformed_self_ty);
             let method_modifiers = count_modifiers(explicit_type);
 
-            debug!("determine_explicit_self_category(self_info.untransformed_self_ty={} \
-                   explicit_type={} \
+            debug!("determine_explicit_self_category(self_info.untransformed_self_ty={:?} \
+                   explicit_type={:?} \
                    modifiers=({},{})",
-                   self_info.untransformed_self_ty.repr(),
-                   explicit_type.repr(),
+                   self_info.untransformed_self_ty,
+                   explicit_type,
                    impl_modifiers,
                    method_modifiers);
 
@@ -1880,8 +1878,8 @@ pub fn ty_of_closure<'tcx>(
     expected_sig: Option<ty::FnSig<'tcx>>)
     -> ty::ClosureTy<'tcx>
 {
-    debug!("ty_of_closure(expected_sig={})",
-           expected_sig.repr());
+    debug!("ty_of_closure(expected_sig={:?})",
+           expected_sig);
 
     // new region names that appear inside of the fn decl are bound to
     // that function type
@@ -1919,8 +1917,8 @@ pub fn ty_of_closure<'tcx>(
         ast::NoReturn(..) => ty::FnDiverging
     };
 
-    debug!("ty_of_closure: input_tys={}", input_tys.repr());
-    debug!("ty_of_closure: output_ty={}", output_ty.repr());
+    debug!("ty_of_closure: input_tys={:?}", input_tys);
+    debug!("ty_of_closure: output_ty={:?}", output_ty);
 
     ty::ClosureTy {
         unsafety: unsafety,
@@ -2037,10 +2035,10 @@ fn compute_object_lifetime_bound<'tcx>(
     let tcx = this.tcx();
 
     debug!("compute_opt_region_bound(explicit_region_bounds={:?}, \
-           principal_trait_ref={}, builtin_bounds={})",
+           principal_trait_ref={:?}, builtin_bounds={:?})",
            explicit_region_bounds,
-           principal_trait_ref.repr(),
-           builtin_bounds.repr());
+           principal_trait_ref,
+           builtin_bounds);
 
     if explicit_region_bounds.len() > 1 {
         span_err!(tcx.sess, explicit_region_bounds[1].span, E0226,
index 0f1498e2be7e2ea8bcb226cc1846a66ab8eca7d7..cf086a32ae599b27803a0437e3b973ced446c067 100644 (file)
@@ -22,7 +22,6 @@
 use check::{instantiate_path, resolve_ty_and_def_ufcs, structurally_resolved_type};
 use require_same_types;
 use util::nodemap::FnvHashMap;
-use util::ppaux::Repr;
 
 use std::cmp::{self, Ordering};
 use std::collections::hash_map::Entry::{Occupied, Vacant};
@@ -40,9 +39,9 @@ pub fn check_pat<'a, 'tcx>(pcx: &pat_ctxt<'a, 'tcx>,
     let fcx = pcx.fcx;
     let tcx = pcx.fcx.ccx.tcx;
 
-    debug!("check_pat(pat={},expected={})",
-           pat.repr(),
-           expected.repr());
+    debug!("check_pat(pat={:?},expected={:?})",
+           pat,
+           expected);
 
     match pat.node {
         ast::PatWild(_) => {
@@ -222,7 +221,7 @@ pub fn check_pat<'a, 'tcx>(pcx: &pat_ctxt<'a, 'tcx>,
                 }
             } else {
                 tcx.sess.span_bug(pat.span,
-                                  &format!("unbound path {}", pat.repr()))
+                                  &format!("unbound path {:?}", pat))
             };
             if let Some((opt_ty, segments, def)) =
                     resolve_ty_and_def_ufcs(fcx, path_res, Some(self_ty),
index ec5752fb50fffb9597f9254e5550511a229d82c0..df9fe6b002efba6efaeee2a74779a969eb4d366a 100644 (file)
@@ -15,7 +15,6 @@
 use middle::ty_fold::TypeFoldable;
 use syntax::ast;
 use syntax::codemap::Span;
-use util::ppaux::Repr;
 
 pub fn normalize_associated_types_in<'a,'tcx,T>(infcx: &InferCtxt<'a,'tcx>,
                                                 typer: &(ty::ClosureTyper<'tcx>+'a),
@@ -26,13 +25,13 @@ pub fn normalize_associated_types_in<'a,'tcx,T>(infcx: &InferCtxt<'a,'tcx>,
                                                 -> T
     where T : TypeFoldable<'tcx> + HasProjectionTypes
 {
-    debug!("normalize_associated_types_in(value={})", value.repr());
+    debug!("normalize_associated_types_in(value={:?})", value);
     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(),
-           obligations.repr());
+    debug!("normalize_associated_types_in: result={:?} predicates={:?}",
+           result,
+           obligations);
     for obligation in obligations {
         fulfillment_cx.register_predicate_obligation(infcx, obligation);
     }
index da1c44604f9fcb9b1206c003933a2f4741fd01c6..e7271d2fa88cf1ef123f12f452208d5292567e57 100644 (file)
@@ -32,7 +32,6 @@
 use syntax::codemap::Span;
 use syntax::parse::token;
 use syntax::ptr::P;
-use util::ppaux::Repr;
 
 /// Check that it is legal to call methods of the trait corresponding
 /// to `trait_id` (this only cares about the trait, not the specific
@@ -120,9 +119,9 @@ fn try_overloaded_call_step<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
                                       autoderefs: usize)
                                       -> Option<CallStep<'tcx>>
 {
-    debug!("try_overloaded_call_step(call_expr={}, adjusted_ty={}, autoderefs={})",
-           call_expr.repr(),
-           adjusted_ty.repr(),
+    debug!("try_overloaded_call_step(call_expr={:?}, adjusted_ty={:?}, autoderefs={})",
+           call_expr,
+           adjusted_ty,
            autoderefs);
 
     // If the callee is a bare function or a closure, then we're all set.
@@ -340,8 +339,8 @@ struct CallResolution<'tcx> {
 
 impl<'tcx> DeferredCallResolution<'tcx> for CallResolution<'tcx> {
     fn resolve<'a>(&mut self, fcx: &FnCtxt<'a,'tcx>) {
-        debug!("DeferredCallResolution::resolve() {}",
-               self.repr());
+        debug!("DeferredCallResolution::resolve() {:?}",
+               self);
 
         // we should not be invoked until the closure kind has been
         // determined by upvar inference
@@ -363,8 +362,8 @@ fn resolve<'a>(&mut self, fcx: &FnCtxt<'a,'tcx>) {
                     ty::no_late_bound_regions(fcx.tcx(),
                                               ty::ty_fn_sig(method_callee.ty)).unwrap();
 
-                debug!("attempt_resolution: method_callee={}",
-                       method_callee.repr());
+                debug!("attempt_resolution: method_callee={:?}",
+                       method_callee);
 
                 for (&method_arg_ty, &self_arg_ty) in
                     method_sig.inputs[1..].iter().zip(&self.fn_sig.inputs)
index 14976bf95593fd6b4ea1e1fac00bb070a77e4f70..9522a21b69ec663d0b19f9aecc7fd73b010a6a6c 100644 (file)
@@ -45,7 +45,6 @@
 use syntax::ast;
 use syntax::ast::UintTy::{TyU8};
 use syntax::codemap::Span;
-use util::ppaux::Repr;
 
 /// Reifies a cast check to be checked once we have full type information for
 /// a function context.
@@ -192,8 +191,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(),
-               self.cast_ty.repr());
+        debug!("check_cast({}, {:?} as {:?})", self.expr.id, self.expr_ty,
+               self.cast_ty);
 
         if ty::type_is_error(self.expr_ty) || ty::type_is_error(self.cast_ty) {
             // No sense in giving duplicate error messages
@@ -273,8 +272,8 @@ fn check_ptr_ptr_cast<'a>(&self,
                               m_cast: &'tcx ty::mt<'tcx>)
                               -> Result<CastKind, CastError>
     {
-        debug!("check_ptr_ptr_cast m_expr={} m_cast={}",
-               m_expr.repr(), m_cast.repr());
+        debug!("check_ptr_ptr_cast m_expr={:?} m_cast={:?}",
+               m_expr, m_cast);
         // ptr-ptr cast. vtables must match.
 
         // Cast to sized is OK
index 16d4c0f997ae16c67919d6acd78350108a897fe1..10b2459b220f2a8ffeb62d94c425d98a9b216553 100644 (file)
@@ -20,7 +20,6 @@
 use syntax::abi;
 use syntax::ast;
 use syntax::ast_util;
-use util::ppaux::Repr;
 
 pub fn check_expr_closure<'a,'tcx>(fcx: &FnCtxt<'a,'tcx>,
                                    expr: &ast::Expr,
@@ -28,9 +27,9 @@ pub fn check_expr_closure<'a,'tcx>(fcx: &FnCtxt<'a,'tcx>,
                                    decl: &'tcx ast::FnDecl,
                                    body: &'tcx ast::Block,
                                    expected: Expectation<'tcx>) {
-    debug!("check_expr_closure(expr={},expected={})",
-           expr.repr(),
-           expected.repr());
+    debug!("check_expr_closure(expr={:?},expected={:?})",
+           expr,
+           expected);
 
     // It's always helpful for inference if we know the kind of
     // closure sooner rather than later, so first examine the expected
@@ -50,9 +49,9 @@ fn check_closure<'a,'tcx>(fcx: &FnCtxt<'a,'tcx>,
                           expected_sig: Option<ty::FnSig<'tcx>>) {
     let expr_def_id = ast_util::local_def(expr.id);
 
-    debug!("check_closure opt_kind={:?} expected_sig={}",
+    debug!("check_closure opt_kind={:?} expected_sig={:?}",
            opt_kind,
-           expected_sig.repr());
+           expected_sig);
 
     let mut fn_ty = astconv::ty_of_closure(
         fcx,
@@ -86,9 +85,9 @@ fn check_closure<'a,'tcx>(fcx: &FnCtxt<'a,'tcx>,
     // the `closures` table.
     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(),
-           fn_ty.sig.repr(),
+    debug!("closure for {:?} --> sig={:?} opt_kind={:?}",
+           expr_def_id,
+           fn_ty.sig,
            opt_kind);
 
     fcx.inh.closure_tys.borrow_mut().insert(expr_def_id, fn_ty);
@@ -103,8 +102,8 @@ fn deduce_expectations_from_expected_type<'a,'tcx>(
     expected_ty: Ty<'tcx>)
     -> (Option<ty::FnSig<'tcx>>,Option<ty::ClosureKind>)
 {
-    debug!("deduce_expectations_from_expected_type(expected_ty={})",
-           expected_ty.repr());
+    debug!("deduce_expectations_from_expected_type(expected_ty={:?})",
+           expected_ty);
 
     match expected_ty.sty {
         ty::TyTrait(ref object_type) => {
@@ -138,8 +137,8 @@ fn deduce_expectations_from_obligations<'a,'tcx>(
         .pending_obligations()
         .iter()
         .filter_map(|obligation| {
-            debug!("deduce_expectations_from_obligations: obligation.predicate={}",
-                   obligation.predicate.repr());
+            debug!("deduce_expectations_from_obligations: obligation.predicate={:?}",
+                   obligation.predicate);
 
             match obligation.predicate {
                 // Given a Projection predicate, we can potentially infer
@@ -200,8 +199,8 @@ fn deduce_sig_from_projection<'a,'tcx>(
 {
     let tcx = fcx.tcx();
 
-    debug!("deduce_sig_from_projection({})",
-           projection.repr());
+    debug!("deduce_sig_from_projection({:?})",
+           projection);
 
     let trait_ref = projection.to_poly_trait_ref();
 
@@ -211,24 +210,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());
+    debug!("deduce_sig_from_projection: arg_param_ty {:?}", arg_param_ty);
 
     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());
+    debug!("deduce_sig_from_projection: input_tys {:?}", input_tys);
 
     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());
+    debug!("deduce_sig_from_projection: ret_param_ty {:?}", ret_param_ty);
 
     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());
+    debug!("deduce_sig_from_projection: fn_sig {:?}", fn_sig);
 
     Some(fn_sig)
 }
@@ -240,9 +239,9 @@ fn self_type_matches_expected_vid<'a,'tcx>(
     -> Option<ty::PolyTraitRef<'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(),
-           self_ty.repr());
+    debug!("self_type_matches_expected_vid(trait_ref={:?}, self_ty={:?})",
+           trait_ref,
+           self_ty);
     match self_ty.sty {
         ty::TyInfer(ty::TyVar(v)) if expected_vid == v => Some(trait_ref),
         _ => None,
index d10a605adb4270d8ddc02b3fba7e871f96ec6cb9..785202de92159e03302f641caebf0f9f4790518b 100644 (file)
@@ -69,7 +69,6 @@
 use middle::ty::{self, mt, Ty};
 use middle::ty_relate::RelateResult;
 use util::common::indent;
-use util::ppaux::Repr;
 
 use std::cell::RefCell;
 use std::collections::VecDeque;
@@ -104,9 +103,9 @@ fn coerce(&self,
               a: Ty<'tcx>,
               b: Ty<'tcx>)
               -> CoerceResult<'tcx> {
-        debug!("Coerce.tys({} => {})",
-               a.repr(),
-               b.repr());
+        debug!("Coerce.tys({:?} => {:?})",
+               a,
+               b);
 
         // Consider coercing the subtype to a DST
         let unsize = self.unpack_actual_value(a, |a| {
@@ -166,9 +165,9 @@ fn coerce_borrowed_pointer(&self,
                                b: Ty<'tcx>,
                                mutbl_b: ast::Mutability)
                                -> CoerceResult<'tcx> {
-        debug!("coerce_borrowed_pointer(a={}, b={})",
-               a.repr(),
-               b.repr());
+        debug!("coerce_borrowed_pointer(a={:?}, b={:?})",
+               a,
+               b);
 
         // If we have a parameter of type `&M T_a` and the value
         // provided is `expr`, we will be adding an implicit borrow,
@@ -238,9 +237,9 @@ fn coerce_unsized(&self,
                       source: Ty<'tcx>,
                       target: Ty<'tcx>)
                       -> CoerceResult<'tcx> {
-        debug!("coerce_unsized(source={}, target={})",
-               source.repr(),
-               target.repr());
+        debug!("coerce_unsized(source={:?}, target={:?})",
+               source,
+               target);
 
         let traits = (self.tcx().lang_items.unsize_trait(),
                       self.tcx().lang_items.coerce_unsized_trait());
@@ -294,7 +293,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());
+            debug!("coerce_unsized resolve step: {:?}", obligation);
             let trait_ref =  match obligation.predicate {
                 ty::Predicate::Trait(ref tr) if traits.contains(&tr.def_id()) => {
                     tr.clone()
@@ -336,7 +335,7 @@ fn coerce_unsized(&self,
             autoref: reborrow,
             unsize: Some(target)
         };
-        debug!("Success, coerced with {}", adjustment.repr());
+        debug!("Success, coerced with {:?}", adjustment);
         Ok(Some(AdjustDerefRef(adjustment)))
     }
 
@@ -352,8 +351,8 @@ fn coerce_from_fn_pointer(&self,
          */
 
         self.unpack_actual_value(b, |b| {
-            debug!("coerce_from_fn_pointer(a={}, b={})",
-                   a.repr(), b.repr());
+            debug!("coerce_from_fn_pointer(a={:?}, b={:?})",
+                   a, b);
 
             if let ty::TyBareFn(None, fn_ty_b) = b.sty {
                 match (fn_ty_a.unsafety, fn_ty_b.unsafety) {
@@ -380,8 +379,8 @@ fn coerce_from_fn_item(&self,
          */
 
         self.unpack_actual_value(b, |b| {
-            debug!("coerce_from_fn_item(a={}, b={})",
-                   a.repr(), b.repr());
+            debug!("coerce_from_fn_item(a={:?}, b={:?})",
+                   a, b);
 
             match b.sty {
                 ty::TyBareFn(None, _) => {
@@ -399,9 +398,9 @@ fn coerce_unsafe_ptr(&self,
                          b: Ty<'tcx>,
                          mutbl_b: ast::Mutability)
                          -> CoerceResult<'tcx> {
-        debug!("coerce_unsafe_ptr(a={}, b={})",
-               a.repr(),
-               b.repr());
+        debug!("coerce_unsafe_ptr(a={:?}, b={:?})",
+               a,
+               b);
 
         let (is_ref, mt_a) = match a.sty {
             ty::TyRef(_, mt) => (true, mt),
@@ -436,7 +435,7 @@ pub fn mk_assignty<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
                              a: Ty<'tcx>,
                              b: Ty<'tcx>)
                              -> RelateResult<'tcx, ()> {
-    debug!("mk_assignty({} -> {})", a.repr(), b.repr());
+    debug!("mk_assignty({:?} -> {:?})", a, b);
     let mut unsizing_obligations = vec![];
     let adjustment = try!(indent(|| {
         fcx.infcx().commit_if_ok(|_| {
@@ -460,7 +459,7 @@ pub fn mk_assignty<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
     }
 
     if let Some(adjustment) = adjustment {
-        debug!("Success, coerced with {}", adjustment.repr());
+        debug!("Success, coerced with {:?}", adjustment);
         fcx.write_adjustment(expr.id, adjustment);
     }
     Ok(())
index 3c38f471c85352cb47d54df7c124a48bb3044ea1..7cd5e4548ec2b74b4c6c54227274dcd093cf50f9 100644 (file)
@@ -13,7 +13,6 @@
 use middle::traits;
 use middle::ty::{self};
 use middle::subst::{self, Subst, Substs, VecPerParamSpace};
-use util::ppaux::Repr;
 
 use syntax::ast;
 use syntax::codemap::Span;
@@ -38,11 +37,11 @@ pub fn compare_impl_method<'tcx>(tcx: &ty::ctxt<'tcx>,
                                  impl_m_body_id: ast::NodeId,
                                  trait_m: &ty::Method<'tcx>,
                                  impl_trait_ref: &ty::TraitRef<'tcx>) {
-    debug!("compare_impl_method(impl_trait_ref={})",
-           impl_trait_ref.repr());
+    debug!("compare_impl_method(impl_trait_ref={:?})",
+           impl_trait_ref);
 
-    debug!("compare_impl_method: impl_trait_ref (liberated) = {}",
-           impl_trait_ref.repr());
+    debug!("compare_impl_method: impl_trait_ref (liberated) = {:?}",
+           impl_trait_ref);
 
     let infcx = infer::new_infer_ctxt(tcx);
     let mut fulfillment_cx = traits::FulfillmentContext::new(true);
@@ -63,16 +62,16 @@ pub fn compare_impl_method<'tcx>(tcx: &ty::ctxt<'tcx>,
             span_err!(tcx.sess, impl_m_span, E0185,
                 "method `{}` has a `{}` declaration in the impl, \
                         but not in the trait",
-                        token::get_name(trait_m.name),
-                        impl_m.explicit_self.repr());
+                        trait_m.name,
+                        impl_m.explicit_self);
             return;
         }
         (_, &ty::StaticExplicitSelfCategory) => {
             span_err!(tcx.sess, impl_m_span, E0186,
                 "method `{}` has a `{}` declaration in the trait, \
                         but not in the impl",
-                        token::get_name(trait_m.name),
-                        trait_m.explicit_self.repr());
+                        trait_m.name,
+                        trait_m.explicit_self);
             return;
         }
         _ => {
@@ -183,8 +182,8 @@ pub fn compare_impl_method<'tcx>(tcx: &ty::ctxt<'tcx>,
         .subst(tcx, impl_to_skol_substs)
         .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());
+    debug!("compare_impl_method: trait_to_skol_substs={:?}",
+           trait_to_skol_substs);
 
     // Check region bounds. FIXME(@jroesch) refactor this away when removing
     // ParamBounds.
@@ -211,8 +210,8 @@ pub fn compare_impl_method<'tcx>(tcx: &ty::ctxt<'tcx>,
             impl_m_span,
             infer::HigherRankedType,
             &ty::Binder(impl_bounds));
-    debug!("compare_impl_method: impl_bounds={}",
-           impl_bounds.repr());
+    debug!("compare_impl_method: impl_bounds={:?}",
+           impl_bounds);
 
     // Normalize the associated types in the trait_bounds.
     let trait_bounds = trait_m.predicates.instantiate(tcx, &trait_to_skol_substs);
@@ -242,8 +241,8 @@ pub fn compare_impl_method<'tcx>(tcx: &ty::ctxt<'tcx>,
     let trait_param_env = traits::normalize_param_env_or_error(trait_param_env,
                                                                normalize_cause.clone());
 
-    debug!("compare_impl_method: trait_bounds={}",
-        trait_param_env.caller_bounds.repr());
+    debug!("compare_impl_method: trait_bounds={:?}",
+        trait_param_env.caller_bounds);
 
     let mut selcx = traits::SelectionContext::new(&infcx, &trait_param_env);
 
@@ -303,8 +302,8 @@ pub fn compare_impl_method<'tcx>(tcx: &ty::ctxt<'tcx>,
                            tcx.mk_bare_fn(ty::BareFnTy { unsafety: impl_m.fty.unsafety,
                                                          abi: impl_m.fty.abi,
                                                          sig: ty::Binder(impl_sig) }));
-        debug!("compare_impl_method: impl_fty={}",
-               impl_fty.repr());
+        debug!("compare_impl_method: impl_fty={:?}",
+               impl_fty);
 
         let (trait_sig, skol_map) =
             infcx.skolemize_late_bound_regions(&trait_m.fty.sig, snapshot);
@@ -324,8 +323,8 @@ pub fn compare_impl_method<'tcx>(tcx: &ty::ctxt<'tcx>,
                                                          abi: trait_m.fty.abi,
                                                          sig: ty::Binder(trait_sig) }));
 
-        debug!("compare_impl_method: trait_fty={}",
-               trait_fty.repr());
+        debug!("compare_impl_method: trait_fty={:?}",
+               trait_fty);
 
         try!(infer::mk_subty(&infcx, false, origin, impl_fty, trait_fty));
 
@@ -335,9 +334,9 @@ pub fn compare_impl_method<'tcx>(tcx: &ty::ctxt<'tcx>,
     match err {
         Ok(()) => { }
         Err(terr) => {
-            debug!("checking trait method for compatibility: impl ty {}, trait ty {}",
-                   impl_fty.repr(),
-                   trait_fty.repr());
+            debug!("checking trait method for compatibility: impl ty {:?}, trait ty {:?}",
+                   impl_fty,
+                   trait_fty);
             span_err!(tcx.sess, impl_m_span, E0053,
                       "method `{}` has an incompatible type for trait: {}",
                       token::get_name(trait_m.name),
@@ -381,14 +380,14 @@ fn check_region_bounds_on_impl_method<'tcx>(tcx: &ty::ctxt<'tcx>,
         let impl_params = impl_generics.regions.get_slice(subst::FnSpace);
 
         debug!("check_region_bounds_on_impl_method: \
-               trait_generics={} \
-               impl_generics={} \
-               trait_to_skol_substs={} \
-               impl_to_skol_substs={}",
-               trait_generics.repr(),
-               impl_generics.repr(),
-               trait_to_skol_substs.repr(),
-               impl_to_skol_substs.repr());
+               trait_generics={:?} \
+               impl_generics={:?} \
+               trait_to_skol_substs={:?} \
+               impl_to_skol_substs={:?}",
+               trait_generics,
+               impl_generics,
+               trait_to_skol_substs,
+               impl_to_skol_substs);
 
         // Must have same number of early-bound lifetime parameters.
         // Unfortunately, if the user screws up the bounds, then this
@@ -416,8 +415,8 @@ pub fn compare_const_impl<'tcx>(tcx: &ty::ctxt<'tcx>,
                                 impl_c_span: Span,
                                 trait_c: &ty::AssociatedConst<'tcx>,
                                 impl_trait_ref: &ty::TraitRef<'tcx>) {
-    debug!("compare_const_impl(impl_trait_ref={})",
-           impl_trait_ref.repr());
+    debug!("compare_const_impl(impl_trait_ref={:?})",
+           impl_trait_ref);
 
     let infcx = infer::new_infer_ctxt(tcx);
     let mut fulfillment_cx = traits::FulfillmentContext::new(true);
@@ -443,8 +442,8 @@ pub fn compare_const_impl<'tcx>(tcx: &ty::ctxt<'tcx>,
         .subst(tcx, impl_to_skol_substs)
         .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());
+    debug!("compare_const_impl: trait_to_skol_substs={:?}",
+           trait_to_skol_substs);
 
     // Compute skolemized form of impl and trait const tys.
     let impl_ty = impl_c.ty.subst(tcx, impl_to_skol_substs);
@@ -461,8 +460,8 @@ pub fn compare_const_impl<'tcx>(tcx: &ty::ctxt<'tcx>,
                                                  impl_c_span,
                                                  0,
                                                  &impl_ty);
-        debug!("compare_const_impl: impl_ty={}",
-               impl_ty.repr());
+        debug!("compare_const_impl: impl_ty={:?}",
+               impl_ty);
 
         let trait_ty =
             assoc::normalize_associated_types_in(&infcx,
@@ -471,8 +470,8 @@ pub fn compare_const_impl<'tcx>(tcx: &ty::ctxt<'tcx>,
                                                  impl_c_span,
                                                  0,
                                                  &trait_ty);
-        debug!("compare_const_impl: trait_ty={}",
-               trait_ty.repr());
+        debug!("compare_const_impl: trait_ty={:?}",
+               trait_ty);
 
         infer::mk_subty(&infcx, false, origin, impl_ty, trait_ty)
     });
@@ -480,9 +479,9 @@ pub fn compare_const_impl<'tcx>(tcx: &ty::ctxt<'tcx>,
     match err {
         Ok(()) => { }
         Err(terr) => {
-            debug!("checking associated const for compatibility: impl ty {}, trait ty {}",
-                   impl_ty.repr(),
-                   trait_ty.repr());
+            debug!("checking associated const for compatibility: impl ty {:?}, trait ty {:?}",
+                   impl_ty,
+                   trait_ty);
             span_err!(tcx.sess, impl_c_span, E0326,
                       "implemented const `{}` has an incompatible type for \
                       trait: {}",
index 3fc833034d221f2cf17542c5601519655d955901..392515926da0c9b71735ffd7423f62b9e92e8877 100644 (file)
@@ -16,7 +16,6 @@
 use std::result::Result::{Err, Ok};
 use syntax::ast;
 use syntax::codemap::Span;
-use util::ppaux::Repr;
 
 // Requires that the two types unify, and prints an error message if
 // they don't.
@@ -59,9 +58,9 @@ pub fn coerce<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
                         expected: Ty<'tcx>,
                         expr: &ast::Expr) {
     let expr_ty = fcx.expr_ty(expr);
-    debug!("demand::coerce(expected = {}, expr_ty = {})",
-           expected.repr(),
-           expr_ty.repr());
+    debug!("demand::coerce(expected = {:?}, expr_ty = {:?})",
+           expected,
+           expr_ty);
     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 14238179f87c29d931c12d1a1468bd565e77a980..fb17f41d88d9a354c4f0bc9898062a61259803b5 100644 (file)
@@ -14,7 +14,6 @@
 use middle::region;
 use middle::subst::{self, Subst};
 use middle::ty::{self, Ty};
-use util::ppaux::{Repr, UserString};
 
 use syntax::ast;
 use syntax::codemap::{self, Span};
@@ -38,7 +37,7 @@
 ///
 pub fn check_drop_impl(tcx: &ty::ctxt, drop_impl_did: ast::DefId) -> Result<(), ()> {
     let ty::TypeScheme { generics: ref dtor_generics,
-                         ty: ref dtor_self_type } = ty::lookup_item_type(tcx, drop_impl_did);
+                         ty: dtor_self_type } = ty::lookup_item_type(tcx, drop_impl_did);
     let dtor_predicates = ty::lookup_predicates(tcx, drop_impl_did);
     match dtor_self_type.sty {
         ty::TyEnum(self_type_did, self_to_impl_substs) |
@@ -47,7 +46,7 @@ pub fn check_drop_impl(tcx: &ty::ctxt, drop_impl_did: ast::DefId) -> Result<(),
             try!(ensure_drop_params_and_item_params_correspond(tcx,
                                                                drop_impl_did,
                                                                dtor_generics,
-                                                               dtor_self_type,
+                                                               &dtor_self_type,
                                                                self_type_did));
 
             ensure_drop_predicates_are_implied_by_item_defn(tcx,
@@ -62,7 +61,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()));
+                               dtor_self_type));
         }
     }
 }
@@ -212,9 +211,8 @@ 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();
             span_err!(tcx.sess, drop_impl_span, E0367,
-                      "The requirement `{}` is added only by the Drop impl.", req);
+                      "The requirement `{}` is added only by the Drop impl.", predicate);
             tcx.sess.span_note(item_span,
                                "The same requirement must be part of \
                                 the struct/enum definition");
@@ -257,8 +255,8 @@ pub fn check_safety_of_destructor_if_necessary<'a, 'tcx>(rcx: &mut Rcx<'a, 'tcx>
                                                      typ: ty::Ty<'tcx>,
                                                      span: Span,
                                                      scope: region::CodeExtent) {
-    debug!("check_safety_of_destructor_if_necessary typ: {} scope: {:?}",
-           typ.repr(), scope);
+    debug!("check_safety_of_destructor_if_necessary typ: {:?} scope: {:?}",
+           typ, scope);
 
     // types that have been traversed so far by `traverse_type_if_unseen`
     let mut breadcrumbs: Vec<Ty<'tcx>> = Vec::new();
@@ -277,8 +275,7 @@ pub fn check_safety_of_destructor_if_necessary<'a, 'tcx>(rcx: &mut Rcx<'a, 'tcx>
         Err(Error::Overflow(ref ctxt, ref detected_on_typ)) => {
             let tcx = rcx.tcx();
             span_err!(tcx.sess, span, E0320,
-                      "overflow while adding drop-check rules for {}",
-                      typ.user_string());
+                      "overflow while adding drop-check rules for {}", typ);
             match *ctxt {
                 TypeContext::Root => {
                     // no need for an additional note if the overflow
@@ -294,7 +291,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());
+                        detected_on_typ);
                 }
                 TypeContext::Struct { def_id, field } => {
                     span_note!(
@@ -303,7 +300,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());
+                        detected_on_typ);
                 }
             }
         }
@@ -372,8 +369,8 @@ fn iterate_over_potentially_unsafe_regions_in_type<'a, 'tcx>(
                     let tp_def = item_type.generics.types
                         .opt_get(subst::TypeSpace, 0).unwrap();
                     let new_typ = substs.type_for_def(tp_def);
-                    debug!("replacing phantom {} with {}",
-                           typ.repr(), new_typ.repr());
+                    debug!("replacing phantom {:?} with {:?}",
+                           typ, new_typ);
                     (new_typ, xref_depth_orig + 1)
                 } else {
                     (typ, xref_depth_orig)
@@ -384,8 +381,8 @@ fn iterate_over_potentially_unsafe_regions_in_type<'a, 'tcx>(
             // definition of `Box<T>` must carry a PhantomData that
             // puts us into the previous case.
             ty::TyBox(new_typ) => {
-                debug!("replacing TyBox {} with {}",
-                       typ.repr(), new_typ.repr());
+                debug!("replacing TyBox {:?} with {:?}",
+                       typ, new_typ);
                 (new_typ, xref_depth_orig + 1)
             }
 
@@ -411,7 +408,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(), scope, xref_depth);
+               typ, scope, xref_depth);
 
         // If `typ` has a destructor, then we must ensure that all
         // borrowed data reachable via `typ` must outlive the parent
@@ -467,8 +464,8 @@ 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());
+                    debug!("typ: {:?} is struct; traverse structure and not type-expression",
+                           typ);
                     // Don't recurse; we extract type's substructure,
                     // so do not process subparts of type expression.
                     walker.skip_current_subtree();
@@ -497,8 +494,8 @@ 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());
+                    debug!("typ: {:?} is enum; traverse structure and not type-expression",
+                           typ);
                     // Don't recurse; we extract type's substructure,
                     // so do not process subparts of type expression.
                     walker.skip_current_subtree();
@@ -571,24 +568,24 @@ fn has_dtor_of_interest<'tcx>(tcx: &ty::ctxt<'tcx>,
     match dtor_kind {
         DtorKind::PureRecur => {
             has_dtor_of_interest = false;
-            debug!("typ: {} has no dtor, and thus is uninteresting",
-                   typ.repr());
+            debug!("typ: {:?} has no dtor, and thus is uninteresting",
+                   typ);
         }
         DtorKind::Unknown(bounds) => {
             match bounds.region_bound {
                 ty::ReStatic => {
-                    debug!("trait: {} has 'static bound, and thus is uninteresting",
-                           typ.repr());
+                    debug!("trait: {:?} has 'static bound, and thus is uninteresting",
+                           typ);
                     has_dtor_of_interest = false;
                 }
                 ty::ReEmpty => {
-                    debug!("trait: {} has empty region bound, and thus is uninteresting",
-                           typ.repr());
+                    debug!("trait: {:?} has empty region bound, and thus is uninteresting",
+                           typ);
                     has_dtor_of_interest = false;
                 }
                 r => {
-                    debug!("trait: {} has non-static bound: {}; assumed interesting",
-                           typ.repr(), r.repr());
+                    debug!("trait: {:?} has non-static bound: {:?}; assumed interesting",
+                           typ, r);
                     has_dtor_of_interest = true;
                 }
             }
@@ -645,8 +642,8 @@ 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(), pred.repr());
+                        debug!("typ: {:?} has interesting dtor due to generic preds, e.g. {:?}",
+                               typ, pred);
                         break 'items;
                     }
                 }
@@ -670,14 +667,14 @@ fn has_dtor_of_interest<'tcx>(tcx: &ty::ctxt<'tcx>,
                 has_pred_of_interest;
 
             if has_dtor_of_interest {
-                debug!("typ: {} has interesting dtor, due to \
+                debug!("typ: {:?} has interesting dtor, due to \
                         region params: {} or pred: {}",
-                       typ.repr(),
+                       typ,
                        has_region_param_of_interest,
                        has_pred_of_interest);
             } else {
-                debug!("typ: {} has dtor, but it is uninteresting",
-                       typ.repr());
+                debug!("typ: {:?} has dtor, but it is uninteresting",
+                       typ);
             }
         }
     }
index 2b5fb524b524f3b94f99ba9f4c04e67f4b107ecf..fd93a2493db5aac32ba00ba579696fabd73946e3 100644 (file)
@@ -24,7 +24,6 @@
 use syntax::ast;
 use syntax::codemap::Span;
 use std::iter::repeat;
-use util::ppaux::Repr;
 
 struct ConfirmContext<'a, 'tcx:'a> {
     fcx: &'a FnCtxt<'a, 'tcx>,
@@ -56,10 +55,10 @@ pub fn confirm<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
                          supplied_method_types: Vec<Ty<'tcx>>)
                          -> MethodCallee<'tcx>
 {
-    debug!("confirm(unadjusted_self_ty={}, pick={}, supplied_method_types={})",
-           unadjusted_self_ty.repr(),
-           pick.repr(),
-           supplied_method_types.repr());
+    debug!("confirm(unadjusted_self_ty={:?}, pick={:?}, supplied_method_types={:?})",
+           unadjusted_self_ty,
+           pick,
+           supplied_method_types);
 
     let mut confirm_cx = ConfirmContext::new(fcx, span, self_expr, call_expr);
     confirm_cx.confirm(unadjusted_self_ty, pick, supplied_method_types)
@@ -93,7 +92,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());
+        debug!("all_substs={:?}", all_substs);
 
         // Create the final signature for the method, replacing late-bound regions.
         let InstantiatedMethodSig {
@@ -225,10 +224,10 @@ fn fresh_receiver_substs(&mut self,
                         this.upcast(original_poly_trait_ref.clone(), trait_def_id);
                     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(),
-                           upcast_trait_ref.repr(),
-                           trait_def_id.repr());
+                    debug!("original_poly_trait_ref={:?} upcast_trait_ref={:?} target_trait={:?}",
+                           original_poly_trait_ref,
+                           upcast_trait_ref,
+                           trait_def_id);
                     let substs = upcast_trait_ref.substs.clone();
                     let origin = MethodTraitObject(MethodObject {
                         trait_ref: upcast_trait_ref,
@@ -322,7 +321,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_ty))
             }
         }
     }
@@ -376,10 +375,8 @@ fn unify_receivers(&mut self,
             Err(_) => {
                 self.tcx().sess.span_bug(
                     self.span,
-                    &format!(
-                        "{} was a subtype of {} but now is not?",
-                        self_ty.repr(),
-                        method_self_ty.repr()));
+                    &format!("{} was a subtype of {} but now is not?",
+                             self_ty, method_self_ty));
             }
         }
     }
@@ -392,9 +389,9 @@ fn instantiate_method_sig(&mut self,
                               all_substs: subst::Substs<'tcx>)
                               -> InstantiatedMethodSig<'tcx>
     {
-        debug!("instantiate_method_sig(pick={}, all_substs={})",
-               pick.repr(),
-               all_substs.repr());
+        debug!("instantiate_method_sig(pick={:?}, all_substs={:?})",
+               pick,
+               all_substs);
 
         // Instantiate the bounds on the method with the
         // type/early-bound-regions substitutions performed. There can
@@ -404,8 +401,8 @@ fn instantiate_method_sig(&mut self,
         let method_predicates = self.fcx.normalize_associated_types_in(self.span,
                                                                        &method_predicates);
 
-        debug!("method_predicates after subst = {}",
-               method_predicates.repr());
+        debug!("method_predicates after subst = {:?}",
+               method_predicates);
 
         // Instantiate late-bound regions and substitute the trait
         // parameters into the method type to get the actual method type.
@@ -415,12 +412,12 @@ fn instantiate_method_sig(&mut self,
         // may reference those regions.
         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());
+        debug!("late-bound lifetimes from method instantiated, method_sig={:?}",
+               method_sig);
 
         let method_sig = self.fcx.instantiate_type_scheme(self.span, &all_substs, &method_sig);
-        debug!("type scheme substituted, method_sig={}",
-               method_sig.repr());
+        debug!("type scheme substituted, method_sig={:?}",
+               method_sig);
 
         InstantiatedMethodSig {
             method_sig: method_sig,
@@ -433,10 +430,10 @@ fn add_obligations(&mut self,
                        pick: &probe::Pick<'tcx>,
                        all_substs: &subst::Substs<'tcx>,
                        method_predicates: &ty::InstantiatedPredicates<'tcx>) {
-        debug!("add_obligations: pick={} all_substs={} method_predicates={}",
-               pick.repr(),
-               all_substs.repr(),
-               method_predicates.repr());
+        debug!("add_obligations: pick={:?} all_substs={:?} method_predicates={:?}",
+               pick,
+               all_substs,
+               method_predicates);
 
         self.fcx.add_obligations_for_parameters(
             traits::ObligationCause::misc(self.span, self.fcx.body_id),
@@ -483,8 +480,8 @@ fn fixup_derefs_on_method_receiver_if_necessary(&self,
             }
         }
 
-        debug!("fixup_derefs_on_method_receiver_if_necessary: exprs={}",
-               exprs.repr());
+        debug!("fixup_derefs_on_method_receiver_if_necessary: exprs={:?}",
+               exprs);
 
         // Fix up autoderefs and derefs.
         for (i, &expr) in exprs.iter().rev().enumerate() {
@@ -498,8 +495,9 @@ fn fixup_derefs_on_method_receiver_if_necessary(&self,
                 Some(_) | None => 0,
             };
 
-            debug!("fixup_derefs_on_method_receiver_if_necessary: i={} expr={} autoderef_count={}",
-                   i, expr.repr(), autoderef_count);
+            debug!("fixup_derefs_on_method_receiver_if_necessary: i={} expr={:?} \
+                                                                  autoderef_count={}",
+                   i, expr, autoderef_count);
 
             if autoderef_count > 0 {
                 check::autoderef(self.fcx,
@@ -545,8 +543,8 @@ fn fixup_derefs_on_method_receiver_if_necessary(&self,
                                 Some(_) => {
                                     self.tcx().sess.span_bug(
                                         base_expr.span,
-                                        &format!("unexpected adjustment autoref {}",
-                                                adr.repr()));
+                                        &format!("unexpected adjustment autoref {:?}",
+                                                adr));
                                 }
                             },
                             None => (0, None),
@@ -647,10 +645,10 @@ fn upcast(&mut self,
         if upcast_trait_refs.len() != 1 {
             self.tcx().sess.span_bug(
                 self.span,
-                &format!("cannot uniquely upcast `{}` to `{}`: `{}`",
-                         source_trait_ref.repr(),
-                         target_trait_def_id.repr(),
-                         upcast_trait_refs.repr()));
+                &format!("cannot uniquely upcast `{:?}` to `{:?}`: `{:?}`",
+                         source_trait_ref,
+                         target_trait_def_id,
+                         upcast_trait_refs));
         }
 
         upcast_trait_refs.into_iter().next().unwrap()
index fd7695b1f0934cdcd0bf9cdaf861018d4c772f56..85a4b02cf804e5bf36f4f96f4a51c8a45cce59fd 100644 (file)
@@ -18,7 +18,6 @@
 use middle::traits;
 use middle::ty::{self, AsPredicate, ToPolyTraitRef};
 use middle::infer;
-use util::ppaux::Repr;
 
 use syntax::ast::DefId;
 use syntax::ast;
@@ -96,11 +95,11 @@ pub fn lookup<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
                         self_expr: &'tcx ast::Expr)
                         -> Result<ty::MethodCallee<'tcx>, MethodError>
 {
-    debug!("lookup(method_name={}, self_ty={}, call_expr={}, self_expr={})",
-           method_name.repr(),
-           self_ty.repr(),
-           call_expr.repr(),
-           self_expr.repr());
+    debug!("lookup(method_name={}, self_ty={:?}, call_expr={:?}, self_expr={:?})",
+           method_name,
+           self_ty,
+           call_expr,
+           self_expr);
 
     let mode = probe::Mode::MethodCall;
     let self_ty = fcx.infcx().resolve_type_vars_if_possible(&self_ty);
@@ -141,11 +140,11 @@ pub fn lookup_in_trait_adjusted<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
                                           opt_input_types: Option<Vec<ty::Ty<'tcx>>>)
                                           -> Option<ty::MethodCallee<'tcx>>
 {
-    debug!("lookup_in_trait_adjusted(self_ty={}, self_expr={}, m_name={}, trait_def_id={})",
-           self_ty.repr(),
-           self_expr.repr(),
-           m_name.repr(),
-           trait_def_id.repr());
+    debug!("lookup_in_trait_adjusted(self_ty={:?}, self_expr={:?}, m_name={}, trait_def_id={:?})",
+           self_ty,
+           self_expr,
+           m_name,
+           trait_def_id);
 
     let trait_def = ty::lookup_trait_def(fcx.tcx(), trait_def_id);
 
@@ -190,8 +189,8 @@ pub fn lookup_in_trait_adjusted<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
     assert_eq!(method_ty.generics.types.len(subst::FnSpace), 0);
     assert_eq!(method_ty.generics.regions.len(subst::FnSpace), 0);
 
-    debug!("lookup_in_trait_adjusted: method_num={} method_ty={}",
-           method_num, method_ty.repr());
+    debug!("lookup_in_trait_adjusted: method_num={} method_ty={:?}",
+           method_num, method_ty);
 
     // Instantiate late-bound regions and substitute the trait
     // parameters into the method type to get the actual method type.
@@ -210,9 +209,9 @@ pub fn lookup_in_trait_adjusted<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
         abi: method_ty.fty.abi.clone(),
     }));
 
-    debug!("lookup_in_trait_adjusted: matched method fty={} obligation={}",
-           fty.repr(),
-           obligation.repr());
+    debug!("lookup_in_trait_adjusted: matched method fty={:?} obligation={:?}",
+           fty,
+           obligation);
 
     // Register obligations for the parameters.  This will include the
     // `Self` parameter, which in turn has a bound of the main trait,
@@ -272,7 +271,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()));
+                                    transformed_self_ty));
                         }
                     }
                 }
@@ -296,7 +295,7 @@ pub fn lookup_in_trait_adjusted<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
         substs: trait_ref.substs.clone()
     };
 
-    debug!("callee = {}", callee.repr());
+    debug!("callee = {:?}", callee);
 
     Some(callee)
 }
index d71b91762e920d2bcb707a4c9677a9931dfd46df..ecf6cad32be76430544ca03e6b736665197d543a 100644 (file)
@@ -28,7 +28,6 @@
 use std::collections::HashSet;
 use std::mem;
 use std::rc::Rc;
-use util::ppaux::Repr;
 
 use self::CandidateKind::*;
 pub use self::PickKind::*;
@@ -127,8 +126,8 @@ pub fn probe<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
                        scope_expr_id: ast::NodeId)
                        -> PickResult<'tcx>
 {
-    debug!("probe(self_ty={}, item_name={}, scope_expr_id={})",
-           self_ty.repr(),
+    debug!("probe(self_ty={:?}, item_name={}, scope_expr_id={})",
+           self_ty,
            item_name,
            scope_expr_id);
 
@@ -167,9 +166,9 @@ pub fn probe<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
             Some(simplified_steps)
         };
 
-    debug!("ProbeContext: steps for self_ty={} are {}",
-           self_ty.repr(),
-           steps.repr());
+    debug!("ProbeContext: steps for self_ty={:?} are {:?}",
+           self_ty,
+           steps);
 
     // this creates one big transaction so that all type variables etc
     // that we create during the probe process are removed later
@@ -272,8 +271,8 @@ fn assemble_inherent_candidates(&mut self) {
     }
 
     fn assemble_probe(&mut self, self_ty: Ty<'tcx>) {
-        debug!("assemble_probe: self_ty={}",
-               self_ty.repr());
+        debug!("assemble_probe: self_ty={:?}",
+               self_ty);
 
         match self_ty.sty {
             ty::TyTrait(box ref data) => {
@@ -416,7 +415,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());
+               xform_self_ty);
 
         self.inherent_candidates.push(Candidate {
             xform_self_ty: xform_self_ty,
@@ -428,8 +427,8 @@ fn assemble_inherent_impl_probe(&mut self, impl_def_id: ast::DefId) {
     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());
+        debug!("assemble_inherent_candidates_from_object(self_ty={:?})",
+               self_ty);
 
         let tcx = self.tcx();
 
@@ -500,10 +499,10 @@ fn assemble_inherent_candidates_from_param(&mut self,
                                    trait_ref.substs);
 
             if let Some(ref m) = item.as_opt_method() {
-                debug!("found match: trait_ref={} substs={} m={}",
-                       trait_ref.repr(),
-                       trait_ref.substs.repr(),
-                       m.repr());
+                debug!("found match: trait_ref={:?} substs={:?} m={:?}",
+                       trait_ref,
+                       trait_ref.substs,
+                       m);
                 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(),
@@ -543,7 +542,7 @@ fn elaborate_bounds<F>(
             usize,
         ),
     {
-        debug!("elaborate_bounds(bounds={})", bounds.repr());
+        debug!("elaborate_bounds(bounds={:?})", bounds);
 
         let tcx = self.tcx();
         for bound_trait_ref in traits::transitive_bounds(tcx, bounds) {
@@ -592,8 +591,8 @@ fn assemble_extension_candidates_for_trait(&mut self,
                                                trait_def_id: ast::DefId)
                                                -> Result<(),MethodError>
     {
-        debug!("assemble_extension_candidates_for_trait(trait_def_id={})",
-               trait_def_id.repr());
+        debug!("assemble_extension_candidates_for_trait(trait_def_id={:?})",
+               trait_def_id);
 
         // Check whether `trait_def_id` defines a method with suitable name:
         let trait_items =
@@ -642,9 +641,10 @@ 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(),
-                   impl_def_id.repr());
+            debug!("assemble_extension_candidates_for_trait_impl: trait_def_id={:?} \
+                                                                  impl_def_id={:?}",
+                   trait_def_id,
+                   impl_def_id);
 
             if !self.impl_can_possibly_match(impl_def_id) {
                 return;
@@ -652,14 +652,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());
+            debug!("impl_substs={:?}", impl_substs);
 
             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());
+            debug!("impl_trait_ref={:?}", impl_trait_ref);
 
             // Determine the receiver type that the method itself expects.
             let xform_self_ty =
@@ -675,7 +675,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());
+            debug!("xform_self_ty={:?}", xform_self_ty);
 
             self.extension_candidates.push(Candidate {
                 xform_self_ty: xform_self_ty,
@@ -773,31 +773,31 @@ fn assemble_projection_candidates(&mut self,
                                       item_index: usize)
     {
         debug!("assemble_projection_candidates(\
-               trait_def_id={}, \
-               item={}, \
+               trait_def_id={:?}, \
+               item={:?}, \
                item_index={})",
-               trait_def_id.repr(),
-               item.repr(),
+               trait_def_id,
+               item,
                item_index);
 
         for step in self.steps.iter() {
-            debug!("assemble_projection_candidates: step={}",
-                   step.repr());
+            debug!("assemble_projection_candidates: step={:?}",
+                   step);
 
             let projection_trait_ref = match step.self_ty.sty {
                 ty::TyProjection(ref data) => &data.trait_ref,
                 _ => continue,
             };
 
-            debug!("assemble_projection_candidates: projection_trait_ref={}",
-                   projection_trait_ref.repr());
+            debug!("assemble_projection_candidates: projection_trait_ref={:?}",
+                   projection_trait_ref);
 
             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());
+            debug!("assemble_projection_candidates: predicates={:?}",
+                   predicates);
             for poly_bound in
                 traits::elaborate_predicates(self.tcx(), predicates)
                 .filter_map(|p| p.to_opt_poly_trait_ref())
@@ -805,18 +805,18 @@ 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(),
-                       bound.repr());
+                debug!("assemble_projection_candidates: projection_trait_ref={:?} bound={:?}",
+                       projection_trait_ref,
+                       bound);
 
                 if self.infcx().can_equate(&step.self_ty, &bound.self_ty()).is_ok() {
                     let xform_self_ty = self.xform_self_ty(&item,
                                                            bound.self_ty(),
                                                            bound.substs);
 
-                    debug!("assemble_projection_candidates: bound={} xform_self_ty={}",
-                           bound.repr(),
-                           xform_self_ty.repr());
+                    debug!("assemble_projection_candidates: bound={:?} xform_self_ty={:?}",
+                           bound,
+                           xform_self_ty);
 
                     self.extension_candidates.push(Candidate {
                         xform_self_ty: xform_self_ty,
@@ -833,8 +833,8 @@ fn assemble_where_clause_candidates(&mut self,
                                         item: ty::ImplOrTraitItem<'tcx>,
                                         item_index: usize)
     {
-        debug!("assemble_where_clause_candidates(trait_def_id={})",
-               trait_def_id.repr());
+        debug!("assemble_where_clause_candidates(trait_def_id={:?})",
+               trait_def_id);
 
         let caller_predicates = self.fcx.inh.param_env.caller_bounds.clone();
         for poly_bound in traits::elaborate_predicates(self.tcx(), caller_predicates)
@@ -846,9 +846,9 @@ fn assemble_where_clause_candidates(&mut self,
                                                    bound.self_ty(),
                                                    bound.substs);
 
-            debug!("assemble_where_clause_candidates: bound={} xform_self_ty={}",
-                   bound.repr(),
-                   xform_self_ty.repr());
+            debug!("assemble_where_clause_candidates: bound={:?} xform_self_ty={:?}",
+                   bound,
+                   xform_self_ty);
 
             self.extension_candidates.push(Candidate {
                 xform_self_ty: xform_self_ty,
@@ -914,7 +914,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());
+        debug!("pick_step: step={:?}", step);
 
         if ty::type_is_error(step.self_ty) {
             return None;
@@ -1012,7 +1012,7 @@ fn consider_candidates(&self,
                   .filter(|&probe| self.consider_probe(self_ty, probe))
                   .collect();
 
-        debug!("applicable_candidates: {}", applicable_candidates.repr());
+        debug!("applicable_candidates: {:?}", applicable_candidates);
 
         if applicable_candidates.len() > 1 {
             match self.collapse_candidates_to_trait_pick(&applicable_candidates[..]) {
@@ -1033,9 +1033,9 @@ 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(),
-               probe.repr());
+        debug!("consider_probe: self_ty={:?} probe={:?}",
+               self_ty,
+               probe);
 
         self.infcx().probe(|_| {
             // First check that the self type can be related.
@@ -1068,7 +1068,7 @@ fn consider_probe(&self, self_ty: Ty<'tcx>, probe: &Candidate<'tcx>) -> bool {
                     let obligations =
                         traits::predicates_for_generics(cause.clone(),
                                                         &impl_bounds);
-                    debug!("impl_obligations={}", obligations.repr());
+                    debug!("impl_obligations={:?}", obligations);
 
                     // Evaluate those obligations to see if they might possibly hold.
                     obligations.iter()
@@ -1180,10 +1180,10 @@ fn xform_method_self_ty(&self,
                             substs: &subst::Substs<'tcx>)
                             -> Ty<'tcx>
     {
-        debug!("xform_self_ty(impl_ty={}, self_ty={}, substs={})",
-               impl_ty.repr(),
-               method.fty.sig.0.inputs.get(0).repr(),
-               substs.repr());
+        debug!("xform_self_ty(impl_ty={:?}, self_ty={:?}, substs={:?})",
+               impl_ty,
+               method.fty.sig.0.inputs.get(0),
+               substs);
 
         assert!(!substs.has_escaping_regions());
 
index 52fdf52c35da7393101993f1284269440d60c372..b098fb56d4db62b20365cdc5d39cc0d7ea02f5d9 100644 (file)
@@ -18,7 +18,6 @@
 use middle::ty::{self, Ty};
 use middle::def;
 use metadata::{csearch, cstore, decoder};
-use util::ppaux::UserString;
 
 use syntax::{ast, ast_util};
 use syntax::codemap::Span;
@@ -45,7 +44,6 @@ 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();
 
             fcx.type_error_message(
                 span,
@@ -54,7 +52,7 @@ pub fn report_error<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
                              in the current scope",
                             if mode == Mode::MethodCall { "method" }
                             else { "associated item" },
-                            item_ustring,
+                            item_name,
                             actual)
                 },
                 rcvr_ty,
@@ -66,7 +64,7 @@ pub fn report_error<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
                 if fields.iter().any(|f| f.name == item_name) {
                     cx.sess.span_note(span,
                         &format!("use `(s.{0})(...)` if you meant to call the \
-                                 function stored in the `{0}` field", item_ustring));
+                                 function stored in the `{0}` field", item_name));
                 }
             }
 
@@ -93,7 +91,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(),
+                               item_name,
                                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 +132,7 @@ fn report_candidates(fcx: &FnCtxt,
                                "candidate #{} is defined in an impl{} for the type `{}`",
                                idx + 1,
                                insertion,
-                               impl_ty.user_string());
+                               impl_ty);
                 }
                 CandidateSource::TraitSource(trait_did) => {
                     let (_, item) = trait_item(fcx.tcx(), trait_did, item_name).unwrap();
@@ -160,7 +158,6 @@ 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();
 
     if !valid_out_of_scope_traits.is_empty() {
         let mut candidates = valid_out_of_scope_traits;
@@ -217,7 +214,7 @@ fn suggest_traits_to_import<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
              perhaps you need to implement {one_of_them}:",
             traits_define = if candidates.len() == 1 {"trait defines"} else {"traits define"},
             one_of_them = if candidates.len() == 1 {"it"} else {"one of them"},
-            name = item_ustring);
+            name = item_name);
 
         fcx.sess().fileline_help(span, &msg[..]);
 
index cc57ec8a8cd8fb878a98eaaf79023fe89bccd81a..34df349b7a3db373c885c57ea970eb468f85cf45 100644 (file)
 use TypeAndSubsts;
 use lint;
 use util::common::{block_query, ErrorReported, indenter, loop_query};
-use util::ppaux::{Repr, UserString};
 use util::nodemap::{DefIdMap, FnvHashMap, NodeMap};
 use util::lev_distance::lev_distance;
 
@@ -567,8 +566,8 @@ fn visit_local(&mut self, local: &'tcx ast::Local) {
             None => None
         };
         self.assign(local.span, local.id, o_ty);
-        debug!("Local variable {} is assigned type {}",
-               self.fcx.pat_to_string(&*local.pat),
+        debug!("Local variable {:?} is assigned type {}",
+               local.pat,
                self.fcx.infcx().ty_to_string(
                    self.fcx.inh.locals.borrow().get(&local.id).unwrap().clone()));
         visit::walk_local(self, local);
@@ -583,11 +582,11 @@ fn visit_pat(&mut self, p: &'tcx ast::Pat) {
                 self.fcx.require_type_is_sized(var_ty, p.span,
                                                traits::VariableType(p.id));
 
-                debug!("Pattern binding {} is assigned to {} with type {}",
+                debug!("Pattern binding {} is assigned to {} with type {:?}",
                        token::get_ident(path1.node),
                        self.fcx.infcx().ty_to_string(
                            self.fcx.inh.locals.borrow().get(&p.id).unwrap().clone()),
-                       var_ty.repr());
+                       var_ty);
             }
         }
         visit::walk_pat(self, p);
@@ -641,9 +640,9 @@ fn check_fn<'a, 'tcx>(ccx: &'a CrateCtxt<'a, 'tcx>,
     let arg_tys = &fn_sig.inputs;
     let ret_ty = fn_sig.output;
 
-    debug!("check_fn(arg_tys={}, ret_ty={}, fn_id={})",
-           arg_tys.repr(),
-           ret_ty.repr(),
+    debug!("check_fn(arg_tys={:?}, ret_ty={:?}, fn_id={})",
+           arg_tys,
+           ret_ty,
            fn_id);
 
     // Create the function context.  This is either derived from scratch or,
@@ -669,9 +668,9 @@ fn check_fn<'a, 'tcx>(ccx: &'a CrateCtxt<'a, 'tcx>,
         fn_sig_tys.push(ret_ty);
     }
 
-    debug!("fn-sig-map: fn_id={} fn_sig_tys={}",
+    debug!("fn-sig-map: fn_id={} fn_sig_tys={:?}",
            fn_id,
-           fn_sig_tys.repr());
+           fn_sig_tys);
 
     inherited.fn_sig_map.borrow_mut().insert(fn_id, fn_sig_tys);
 
@@ -918,12 +917,12 @@ fn check_method_body<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
                                sig: &'tcx ast::MethodSig,
                                body: &'tcx ast::Block,
                                id: ast::NodeId, span: Span) {
-    debug!("check_method_body(item_generics={}, id={})",
-            item_generics.repr(), id);
+    debug!("check_method_body(item_generics={:?}, id={})",
+            item_generics, 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());
+    debug!("check_method_body: fty={:?}", fty);
 
     check_bare_fn(ccx, &sig.decl, body, id, span, fty, param_env);
 }
@@ -963,9 +962,9 @@ fn check_impl_items_against_trait<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
                             _ => {
                                 span_err!(tcx.sess, impl_item.span, E0323,
                                           "item `{}` is an associated const, \
-                                          which doesn't match its trait `{}`",
+                                          which doesn't match its trait `{:?}`",
                                           token::get_name(impl_const_ty.name()),
-                                          impl_trait_ref.repr())
+                                          impl_trait_ref)
                             }
                         }
                     }
@@ -976,9 +975,9 @@ fn check_impl_items_against_trait<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
                             impl_item.span,
                             &format!(
                                 "associated const `{}` is not a member of \
-                                 trait `{}`",
+                                 trait `{:?}`",
                                 token::get_name(impl_const_ty.name()),
-                                impl_trait_ref.repr()));
+                                impl_trait_ref));
                     }
                 }
             }
@@ -1009,9 +1008,9 @@ trait `{}`",
                             _ => {
                                 span_err!(tcx.sess, impl_item.span, E0324,
                                           "item `{}` is an associated method, \
-                                          which doesn't match its trait `{}`",
+                                          which doesn't match its trait `{:?}`",
                                           token::get_name(impl_item_ty.name()),
-                                          impl_trait_ref.repr())
+                                          impl_trait_ref)
                             }
                         }
                     }
@@ -1020,9 +1019,9 @@ trait `{}`",
                         // caught in resolve.
                         tcx.sess.span_bug(
                             impl_item.span,
-                            &format!("method `{}` is not a member of trait `{}`",
+                            &format!("method `{}` is not a member of trait `{:?}`",
                                      token::get_name(impl_item_ty.name()),
-                                     impl_trait_ref.repr()));
+                                     impl_trait_ref));
                     }
                 }
             }
@@ -1043,9 +1042,9 @@ trait `{}`",
                             _ => {
                                 span_err!(tcx.sess, impl_item.span, E0325,
                                           "item `{}` is an associated type, \
-                                          which doesn't match its trait `{}`",
+                                          which doesn't match its trait `{:?}`",
                                           token::get_name(typedef_ty.name()),
-                                          impl_trait_ref.repr())
+                                          impl_trait_ref)
                             }
                         }
                     }
@@ -1056,9 +1055,9 @@ trait `{}`",
                             impl_item.span,
                             &format!(
                                 "associated type `{}` is not a member of \
-                                 trait `{}`",
+                                 trait `{:?}`",
                                 token::get_name(typedef_ty.name()),
-                                impl_trait_ref.repr()));
+                                impl_trait_ref));
                     }
                 }
             }
@@ -1295,18 +1294,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());
+        debug!("resolve_type_vars_if_possible(ty={:?})", ty);
 
         // No ty::infer()? Nothing needs doing.
         if !ty::type_has_ty_infer(ty) {
-            debug!("resolve_type_vars_if_possible: ty={}", ty.repr());
+            debug!("resolve_type_vars_if_possible: ty={:?}", ty);
             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());
+            debug!("resolve_type_vars_if_possible: ty={:?}", ty);
             return ty;
         }
 
@@ -1314,7 +1313,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());
+            debug!("resolve_type_vars_if_possible: ty={:?}", ty);
             return ty;
         }
 
@@ -1325,7 +1324,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());
+        debug!("resolve_type_vars_if_possible: ty={:?}", ty);
         ty
     }
 
@@ -1395,16 +1394,16 @@ 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.tag());
+        debug!("write_ty({}, {:?}) in fcx {}",
+               node_id, ty, self.tag());
         self.inh.node_types.borrow_mut().insert(node_id, ty);
     }
 
     pub fn write_substs(&self, node_id: ast::NodeId, substs: ty::ItemSubsts<'tcx>) {
         if !substs.substs.is_noop() {
-            debug!("write_substs({}, {}) in fcx {}",
+            debug!("write_substs({}, {:?}) in fcx {}",
                    node_id,
-                   substs.repr(),
+                   substs,
                    self.tag());
 
             self.inh.item_substs.borrow_mut().insert(node_id, substs);
@@ -1427,7 +1426,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());
+        debug!("write_adjustment(node_id={}, adj={:?})", node_id, adj);
 
         if adj.is_identity() {
             return;
@@ -1448,10 +1447,10 @@ fn instantiate_type_scheme<T>(&self,
     {
         let value = value.subst(self.tcx(), substs);
         let result = self.normalize_associated_types_in(span, &value);
-        debug!("instantiate_type_scheme(value={}, substs={}) = {}",
-               value.repr(),
-               substs.repr(),
-               result.repr());
+        debug!("instantiate_type_scheme(value={:?}, substs={:?}) = {:?}",
+               value,
+               substs,
+               result);
         result
     }
 
@@ -1615,8 +1614,8 @@ pub fn register_builtin_bound(&self,
     pub fn register_predicate(&self,
                               obligation: traits::PredicateObligation<'tcx>)
     {
-        debug!("register_predicate({})",
-               obligation.repr());
+        debug!("register_predicate({:?})",
+               obligation);
         self.inh.fulfillment_cx
             .borrow_mut()
             .register_predicate_obligation(self.infcx(), obligation);
@@ -1633,10 +1632,6 @@ pub fn to_ty(&self, ast_t: &ast::Ty) -> Ty<'tcx> {
         t
     }
 
-    pub fn pat_to_string(&self, pat: &ast::Pat) -> String {
-        pat.repr()
-    }
-
     pub fn expr_ty(&self, ex: &ast::Expr) -> Ty<'tcx> {
         match self.inh.node_types.borrow().get(&ex.id) {
             Some(&t) => t,
@@ -1784,8 +1779,8 @@ pub fn add_obligations_for_parameters(&self,
     {
         assert!(!predicates.has_escaping_regions());
 
-        debug!("add_obligations_for_parameters(predicates={})",
-               predicates.repr());
+        debug!("add_obligations_for_parameters(predicates={:?})",
+               predicates);
 
         for obligation in traits::predicates_for_generics(cause, predicates) {
             self.register_predicate(obligation);
@@ -1940,9 +1935,9 @@ pub fn autoderef<'a, 'tcx, T, F>(fcx: &FnCtxt<'a, 'tcx>,
                                  -> (Ty<'tcx>, usize, Option<T>)
     where F: FnMut(Ty<'tcx>, usize) -> Option<T>,
 {
-    debug!("autoderef(base_ty={}, opt_expr={}, lvalue_pref={:?})",
-           base_ty.repr(),
-           opt_expr.repr(),
+    debug!("autoderef(base_ty={:?}, opt_expr={:?}, lvalue_pref={:?})",
+           base_ty,
+           opt_expr,
            lvalue_pref);
 
     let mut t = base_ty;
@@ -2002,8 +1997,8 @@ 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());
+        "reached the recursion limit while auto-dereferencing {:?}",
+        base_ty);
     (fcx.tcx().types.err, 0, None)
 }
 
@@ -2118,14 +2113,14 @@ fn try_index_step<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
                             -> Option<(/*index type*/ Ty<'tcx>, /*element type*/ Ty<'tcx>)>
 {
     let tcx = fcx.tcx();
-    debug!("try_index_step(expr={}, base_expr.id={}, adjusted_ty={}, \
-                           autoderefs={}, unsize={}, index_ty={})",
-           expr.repr(),
-           base_expr.repr(),
-           adjusted_ty.repr(),
+    debug!("try_index_step(expr={:?}, base_expr.id={:?}, adjusted_ty={:?}, \
+                           autoderefs={}, unsize={}, index_ty={:?})",
+           expr,
+           base_expr,
+           adjusted_ty,
            autoderefs,
            unsize,
-           index_ty.repr());
+           index_ty);
 
     let input_ty = fcx.infcx().next_ty_var();
 
@@ -2604,9 +2599,9 @@ fn expected_types_for_fn_args<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
             None
         }
     }).unwrap_or(vec![]);
-    debug!("expected_types_for_fn_args(formal={} -> {}, expected={} -> {})",
-           formal_args.repr(), formal_ret.repr(),
-           expected_args.repr(), expected_ret.repr());
+    debug!("expected_types_for_fn_args(formal={:?} -> {:?}, expected={:?} -> {:?})",
+           formal_args, formal_ret,
+           expected_args, expected_ret);
     expected_args
 }
 
@@ -2627,8 +2622,8 @@ fn check_expr_with_unifier<'a, 'tcx, F>(fcx: &FnCtxt<'a, 'tcx>,
                                         unifier: F) where
     F: FnOnce(),
 {
-    debug!(">> typechecking: expr={} expected={}",
-           expr.repr(), expected.repr());
+    debug!(">> typechecking: expr={:?} expected={:?}",
+           expr, expected);
 
     // Checks a method call.
     fn check_method_call<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
@@ -2744,7 +2739,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());
+                        debug!("struct named {:?}",  base_t);
                         let fields = ty::lookup_struct_fields(tcx, base_id);
                         fcx.lookup_field_ty(expr.span, base_id, &fields[..],
                                             field.node.name, &(*substs))
@@ -2848,7 +2843,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());
+                            debug!("tuple struct named {:?}",  base_t);
                             let fields = ty::lookup_struct_fields(tcx, base_id);
                             fcx.lookup_tup_field_ty(expr.span, base_id, &fields[..],
                                                     idx.node, &(*substs))
@@ -3274,7 +3269,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()))
+                                &format!("unbound path {:?}", expr))
           };
 
           if let Some((opt_ty, segments, def)) =
@@ -3744,9 +3739,9 @@ 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(),
-           expected.repr());
+    debug!("... {:?}, expected is {:?}",
+           fcx.expr_ty(expr),
+           expected);
 
     unifier();
 }
@@ -4179,8 +4174,8 @@ pub fn check_instantiable(tcx: &ty::ctxt,
         span_err!(tcx.sess, sp, E0073,
             "this type cannot be instantiated without an \
              instance of itself");
-        fileline_help!(tcx.sess, sp, "consider using `Option<{}>`",
-             item_ty.repr());
+        fileline_help!(tcx.sess, sp, "consider using `Option<{:?}>`",
+             item_ty);
         false
     } else {
         true
@@ -4371,11 +4366,11 @@ pub fn instantiate_path<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
                                   def: def::Def,
                                   span: Span,
                                   node_id: ast::NodeId) {
-    debug!("instantiate_path(path={:?}, def={}, node_id={}, type_scheme={})",
+    debug!("instantiate_path(path={:?}, def={:?}, node_id={}, type_scheme={:?})",
            segments,
-           def.repr(),
+           def,
            node_id,
-           type_scheme.repr());
+           type_scheme);
 
     // 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
@@ -4615,9 +4610,9 @@ pub fn instantiate_path<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
         if fcx.mk_subty(false, infer::Misc(span), self_ty, impl_ty).is_err() {
             fcx.tcx().sess.span_bug(span,
             &format!(
-                "instantiate_path: (UFCS) {} was a subtype of {} but now is not?",
-                self_ty.repr(),
-                impl_ty.repr()));
+                "instantiate_path: (UFCS) {:?} was a subtype of {:?} but now is not?",
+                self_ty,
+                impl_ty));
         }
     }
 
@@ -4822,7 +4817,7 @@ fn adjust_type_parameters<'a, 'tcx>(
         }
         assert_eq!(substs.types.len(space), desired.len());
 
-        debug!("Final substs: {}", substs.repr());
+        debug!("Final substs: {:?}", substs);
     }
 
     fn adjust_region_parameters(
@@ -4931,8 +4926,8 @@ pub fn check_bounds_are_used<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
                                        span: Span,
                                        tps: &OwnedSlice<ast::TyParam>,
                                        ty: Ty<'tcx>) {
-    debug!("check_bounds_are_used(n_tps={}, ty={})",
-           tps.len(),  ty.repr());
+    debug!("check_bounds_are_used(n_tps={}, ty={:?})",
+           tps.len(),  ty);
 
     // make a vector of booleans initially false, set to true when used
     if tps.is_empty() { return; }
@@ -5255,7 +5250,7 @@ fn param<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>, n: u32) -> Ty<'tcx> {
                            fty,
                            || {
                 format!("intrinsic has wrong type: expected `{}`",
-                         fty.user_string())
+                         fty)
             });
     }
 }
index fbff7afb3e59c51c10e534043ff5ecab893118fb..a5e4e0fab5963795012ea8be23f324817368e787 100644 (file)
@@ -25,7 +25,6 @@
 use syntax::ast;
 use syntax::ast_util;
 use syntax::parse::token;
-use util::ppaux::{Repr, UserString};
 
 /// Check a `a <op>= b`
 pub fn check_binop_assign<'a,'tcx>(fcx: &FnCtxt<'a,'tcx>,
@@ -51,8 +50,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(),
-                  rhs_ty.user_string());
+                  lhs_ty,
+                  rhs_ty);
         fcx.write_error(expr.id);
     }
 
@@ -73,12 +72,12 @@ pub fn check_binop<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
 {
     let tcx = fcx.ccx.tcx;
 
-    debug!("check_binop(expr.id={}, expr={}, op={:?}, lhs_expr={}, rhs_expr={})",
+    debug!("check_binop(expr.id={}, expr={:?}, op={:?}, lhs_expr={:?}, rhs_expr={:?})",
            expr.id,
-           expr.repr(),
+           expr,
            op,
-           lhs_expr.repr(),
-           rhs_expr.repr());
+           lhs_expr,
+           rhs_expr);
 
     check_expr(fcx, lhs_expr);
     let lhs_ty = fcx.resolve_type_vars_if_possible(fcx.expr_ty(lhs_expr));
@@ -180,16 +179,16 @@ fn enforce_builtin_binop_types<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
             // if this is simd, result is same as lhs, else bool
             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(),
-                       unit_ty.repr());
+                debug!("enforce_builtin_binop_types: lhs_ty={:?} unit_ty={:?}",
+                       lhs_ty,
+                       unit_ty);
                 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()));
+                                 lhs_ty));
                     tcx.types.err
                 } else {
                     lhs_ty
@@ -209,9 +208,9 @@ fn check_overloaded_binop<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
                                     op: ast::BinOp)
                                     -> (Ty<'tcx>, Ty<'tcx>)
 {
-    debug!("check_overloaded_binop(expr.id={}, lhs_ty={})",
+    debug!("check_overloaded_binop(expr.id={}, lhs_ty={:?})",
            expr.id,
-           lhs_ty.repr());
+           lhs_ty);
 
     let (name, trait_def_id) = name_and_trait_def_id(fcx, op);
 
@@ -233,7 +232,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());
+                          lhs_ty);
             }
             fcx.tcx().types.err
         }
@@ -304,12 +303,12 @@ fn lookup_op_method<'a, 'tcx>(fcx: &'a FnCtxt<'a, 'tcx>,
                               lhs_expr: &'a ast::Expr)
                               -> Result<Ty<'tcx>,()>
 {
-    debug!("lookup_op_method(expr={}, lhs_ty={}, opname={:?}, trait_did={}, lhs_expr={})",
-           expr.repr(),
-           lhs_ty.repr(),
+    debug!("lookup_op_method(expr={:?}, lhs_ty={:?}, opname={:?}, trait_did={:?}, lhs_expr={:?})",
+           expr,
+           lhs_ty,
            opname,
-           trait_did.repr(),
-           lhs_expr.repr());
+           trait_did,
+           lhs_expr);
 
     let method = match trait_did {
         Some(trait_did) => {
index 949cf118afca4c229a1db0b1b44d4ccfb54a5559..a96e7864fe679c8a4d63e69d16c8e79e4100f48c 100644 (file)
@@ -94,7 +94,6 @@
 use middle::ty::{self, ClosureTyper, ReScope, Ty, MethodCall};
 use middle::infer::{self, GenericKind};
 use middle::pat_util;
-use util::ppaux::{Repr, UserString};
 
 use std::mem;
 use syntax::{ast, ast_util};
@@ -321,8 +320,8 @@ fn visit_region_obligations(&mut self, node_id: ast::NodeId)
                                        .to_vec();
 
         for r_o in &region_obligations {
-            debug!("visit_region_obligations: r_o={}",
-                   r_o.repr());
+            debug!("visit_region_obligations: r_o={:?}",
+                   r_o);
             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);
@@ -351,7 +350,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());
+            debug!("relate_free_regions(t={:?})", ty);
             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,
@@ -364,7 +363,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());
+                debug!("implication: {:?}", implication);
                 match implication {
                     implicator::Implication::RegionSubRegion(_,
                                                              ty::ReFree(free_a),
@@ -372,8 +371,8 @@ fn relate_free_regions(&mut self,
                         self.fcx.inh.infcx.add_given(free_a, vid_b);
                     }
                     implicator::Implication::RegionSubGeneric(_, r_a, ref generic_b) => {
-                        debug!("RegionSubGeneric: {} <= {}",
-                               r_a.repr(), generic_b.repr());
+                        debug!("RegionSubGeneric: {:?} <= {:?}",
+                               r_a, generic_b);
 
                         self.region_bound_pairs.push((r_a, generic_b.clone()));
                     }
@@ -464,7 +463,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());
+    debug!("regionck::visit_pat(pat={:?})", pat);
     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
@@ -501,8 +500,8 @@ 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.repeating_scope);
+    debug!("regionck::visit_expr(e={:?}, repeating_scope={})",
+           expr, rcx.repeating_scope);
 
     // No matter what, the type of each expression must outlive the
     // scope of that expression. This also guarantees basic WF.
@@ -744,9 +743,9 @@ fn constrain_cast(rcx: &mut Rcx,
                   cast_expr: &ast::Expr,
                   source_expr: &ast::Expr)
 {
-    debug!("constrain_cast(cast_expr={}, source_expr={})",
-           cast_expr.repr(),
-           source_expr.repr());
+    debug!("constrain_cast(cast_expr={:?}, source_expr={:?})",
+           cast_expr,
+           source_expr);
 
     let source_ty = rcx.resolve_node_type(source_expr.id);
     let target_ty = rcx.resolve_node_type(cast_expr.id);
@@ -757,9 +756,9 @@ fn walk_cast<'a, 'tcx>(rcx: &mut Rcx<'a, 'tcx>,
                            cast_expr: &ast::Expr,
                            from_ty: Ty<'tcx>,
                            to_ty: Ty<'tcx>) {
-        debug!("walk_cast(from_ty={}, to_ty={})",
-               from_ty.repr(),
-               to_ty.repr());
+        debug!("walk_cast(from_ty={:?}, to_ty={:?})",
+               from_ty,
+               to_ty);
         match (&from_ty.sty, &to_ty.sty) {
             /*From:*/ (&ty::TyRef(from_r, ref from_mt),
             /*To:  */  &ty::TyRef(to_r, ref to_mt)) => {
@@ -807,7 +806,7 @@ fn constrain_callee(rcx: &mut Rcx,
             //
             // tcx.sess.span_bug(
             //     callee_expr.span,
-            //     format!("Calling non-function: {}", callee_ty.repr()));
+            //     format!("Calling non-function: {}", callee_ty));
         }
     }
 }
@@ -822,11 +821,11 @@ fn constrain_call<'a, I: Iterator<Item=&'a ast::Expr>>(rcx: &mut Rcx,
     //! in the type of the function. Also constrains the regions that
     //! appear in the arguments appropriately.
 
-    debug!("constrain_call(call_expr={}, \
-            receiver={}, \
+    debug!("constrain_call(call_expr={:?}, \
+            receiver={:?}, \
             implicitly_ref_args={})",
-            call_expr.repr(),
-            receiver.repr(),
+            call_expr,
+            receiver,
             implicitly_ref_args);
 
     // `callee_region` is the scope representing the time in which the
@@ -836,10 +835,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());
+    debug!("callee_region={:?}", callee_region);
 
     for arg_expr in arg_exprs {
-        debug!("Argument: {}", arg_expr.repr());
+        debug!("Argument: {:?}", arg_expr);
 
         // ensure that any regions appearing in the argument type are
         // valid for at least the lifetime of the function:
@@ -858,7 +857,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());
+        debug!("receiver: {:?}", r);
         type_of_node_must_outlive(
             rcx, infer::CallRcvr(r.span),
             r.id, callee_region);
@@ -875,10 +874,10 @@ fn constrain_autoderefs<'a, 'tcx>(rcx: &mut Rcx<'a, 'tcx>,
                                   derefs: usize,
                                   mut derefd_ty: Ty<'tcx>)
 {
-    debug!("constrain_autoderefs(deref_expr={}, derefs={}, derefd_ty={})",
-           deref_expr.repr(),
+    debug!("constrain_autoderefs(deref_expr={:?}, derefs={}, derefd_ty={:?})",
+           deref_expr,
            derefs,
-           derefd_ty.repr());
+           derefd_ty);
 
     let r_deref_expr = ty::ReScope(CodeExtent::from_node_id(deref_expr.id));
     for i in 0..derefs {
@@ -887,8 +886,8 @@ 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());
+                debug!("constrain_autoderefs: #{} is overloaded, method={:?}",
+                       i, method);
 
                 // Treat overloaded autoderefs as if an AutoRef adjustment
                 // was applied on the base type, as that is always the case.
@@ -901,19 +900,19 @@ 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()))
+                            &format!("bad overloaded deref type {:?}",
+                                     method.ty))
                     }
                 };
 
                 debug!("constrain_autoderefs: receiver r={:?} m={:?}",
-                       r.repr(), m);
+                       r, 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());
+                           self_cmt);
                     link_region(rcx, deref_expr.span, r,
                                 ty::BorrowKind::from_mutbl(m), self_cmt);
                 }
@@ -974,8 +973,8 @@ fn check_safety_of_rvalue_destructor_if_necessary<'a, 'tcx>(rcx: &mut Rcx<'a, 't
                        .sess
                        .span_bug(span,
                                  &format!("unexpected rvalue region in rvalue \
-                                           destructor safety checking: `{}`",
-                                          region.repr()));
+                                           destructor safety checking: `{:?}`",
+                                          region));
                 }
             }
         }
@@ -1023,7 +1022,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(),  ty0.user_string(),
+            ty,  ty0,
            id, minimum_lifetime);
     type_must_outlive(rcx, origin, ty, minimum_lifetime);
 }
@@ -1032,14 +1031,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(), base.repr());
+    debug!("link_addr_of(expr={:?}, base={:?})", expr, base);
 
     let cmt = {
         let mc = mc::MemCategorizationContext::new(rcx.fcx);
         ignore_err!(mc.cat_expr(base))
     };
 
-    debug!("link_addr_of: cmt={}", cmt.repr());
+    debug!("link_addr_of: cmt={:?}", cmt);
 
     link_region_from_node_type(rcx, expr.span, expr.id, mutability, cmt);
 }
@@ -1065,7 +1064,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());
+    debug!("discr_cmt={:?}", discr_cmt);
     for arm in arms {
         for root_pat in &arm.pats {
             link_pattern(rcx, mc, discr_cmt.clone(), &**root_pat);
@@ -1083,9 +1082,9 @@ fn link_fn_args(rcx: &Rcx, body_scope: CodeExtent, args: &[ast::Arg]) {
         let arg_ty = rcx.fcx.node_ty(arg.id);
         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(),
-               arg_cmt.repr());
+        debug!("arg_ty={:?} arg_cmt={:?}",
+               arg_ty,
+               arg_cmt);
         link_pattern(rcx, mc, arg_cmt, &*arg.pat);
     }
 }
@@ -1096,9 +1095,9 @@ fn link_pattern<'a, 'tcx>(rcx: &Rcx<'a, 'tcx>,
                           mc: mc::MemCategorizationContext<FnCtxt<'a, 'tcx>>,
                           discr_cmt: mc::cmt<'tcx>,
                           root_pat: &ast::Pat) {
-    debug!("link_pattern(discr_cmt={}, root_pat={})",
-           discr_cmt.repr(),
-           root_pat.repr());
+    debug!("link_pattern(discr_cmt={:?}, root_pat={:?})",
+           discr_cmt,
+           root_pat);
     let _ = mc.cat_pattern(discr_cmt, root_pat, |mc, sub_cmt, sub_pat| {
             match sub_pat.node {
                 // `ref x` pattern
@@ -1134,7 +1133,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());
+    debug!("expr_cmt={:?}", expr_cmt);
 
     match *autoref {
         ty::AutoPtr(r, m) => {
@@ -1154,8 +1153,8 @@ fn link_autoref(rcx: &Rcx,
 fn link_by_ref(rcx: &Rcx,
                expr: &ast::Expr,
                callee_scope: CodeExtent) {
-    debug!("link_by_ref(expr={}, callee_scope={:?})",
-           expr.repr(), callee_scope);
+    debug!("link_by_ref(expr={:?}, callee_scope={:?})",
+           expr, 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);
@@ -1169,13 +1168,13 @@ fn link_region_from_node_type<'a, 'tcx>(rcx: &Rcx<'a, 'tcx>,
                                         id: ast::NodeId,
                                         mutbl: ast::Mutability,
                                         cmt_borrowed: mc::cmt<'tcx>) {
-    debug!("link_region_from_node_type(id={:?}, mutbl={:?}, cmt_borrowed={})",
-           id, mutbl, cmt_borrowed.repr());
+    debug!("link_region_from_node_type(id={:?}, mutbl={:?}, cmt_borrowed={:?})",
+           id, mutbl, cmt_borrowed);
 
     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());
+        debug!("rptr_ty={}",  rptr_ty);
         let r = ty::ty_region(tcx, span, rptr_ty);
         link_region(rcx, span, &r, ty::BorrowKind::from_mutbl(mutbl),
                     cmt_borrowed);
@@ -1194,10 +1193,10 @@ fn link_region<'a, 'tcx>(rcx: &Rcx<'a, 'tcx>,
     let mut borrow_kind = borrow_kind;
 
     loop {
-        debug!("link_region(borrow_region={}, borrow_kind={}, borrow_cmt={})",
-               borrow_region.repr(),
-               borrow_kind.repr(),
-               borrow_cmt.repr());
+        debug!("link_region(borrow_region={:?}, borrow_kind={:?}, borrow_cmt={:?})",
+               borrow_region,
+               borrow_kind,
+               borrow_cmt);
         match borrow_cmt.cat.clone() {
             mc::cat_deref(ref_cmt, _,
                           mc::Implicit(ref_kind, ref_region)) |
@@ -1307,8 +1306,8 @@ fn link_reborrowed_region<'a, 'tcx>(rcx: &Rcx<'a, 'tcx>,
                 _ => {
                     rcx.tcx().sess.span_bug(
                         span,
-                        &format!("Illegal upvar id: {}",
-                                upvar_id.repr()));
+                        &format!("Illegal upvar id: {:?}",
+                                upvar_id));
                 }
             }
         }
@@ -1323,9 +1322,9 @@ fn link_reborrowed_region<'a, 'tcx>(rcx: &Rcx<'a, 'tcx>,
         }
     };
 
-    debug!("link_reborrowed_region: {} <= {}",
-           borrow_region.repr(),
-           ref_region.repr());
+    debug!("link_reborrowed_region: {:?} <= {:?}",
+           borrow_region,
+           ref_region);
     rcx.fcx.mk_subr(cause, *borrow_region, ref_region);
 
     // If we end up needing to recurse and establish a region link
@@ -1398,14 +1397,14 @@ pub fn type_must_outlive<'a, 'tcx>(rcx: &mut Rcx<'a, 'tcx>,
                                ty: Ty<'tcx>,
                                region: ty::Region)
 {
-    debug!("type_must_outlive(ty={}, region={})",
-           ty.repr(),
-           region.repr());
+    debug!("type_must_outlive(ty={:?}, region={:?})",
+           ty,
+           region);
 
     let implications = implicator::implications(rcx.fcx.infcx(), rcx.fcx, rcx.body_id,
                                                 ty, region, origin.span());
     for implication in implications {
-        debug!("implication: {}", implication.repr());
+        debug!("implication: {:?}", implication);
         match implication {
             implicator::Implication::RegionSubRegion(None, r_a, r_b) => {
                 rcx.fcx.mk_subr(origin.clone(), r_a, r_b);
@@ -1440,8 +1439,8 @@ fn closure_must_outlive<'a, 'tcx>(rcx: &mut Rcx<'a, 'tcx>,
                                   region: ty::Region,
                                   def_id: ast::DefId,
                                   substs: &'tcx Substs<'tcx>) {
-    debug!("closure_must_outlive(region={}, def_id={}, substs={})",
-           region.repr(), def_id.repr(), substs.repr());
+    debug!("closure_must_outlive(region={:?}, def_id={:?}, substs={:?})",
+           region, def_id, substs);
 
     let upvars = rcx.fcx.closure_upvars(def_id, substs).unwrap();
     for upvar in upvars {
@@ -1458,9 +1457,9 @@ fn generic_must_outlive<'a, 'tcx>(rcx: &Rcx<'a, 'tcx>,
                                   generic: &GenericKind<'tcx>) {
     let param_env = &rcx.fcx.inh.param_env;
 
-    debug!("param_must_outlive(region={}, generic={})",
-           region.repr(),
-           generic.repr());
+    debug!("param_must_outlive(region={:?}, generic={:?})",
+           region,
+           generic);
 
     // To start, collect bounds from user:
     let mut param_bounds =
@@ -1493,9 +1492,9 @@ fn generic_must_outlive<'a, 'tcx>(rcx: &Rcx<'a, 'tcx>,
     // well-formed, then, A must be lower-generic by `'a`, but we
     // don't know that this holds from first principles.
     for &(ref r, ref p) in &rcx.region_bound_pairs {
-        debug!("generic={} p={}",
-               generic.repr(),
-               p.repr());
+        debug!("generic={:?} p={:?}",
+               generic,
+               p);
         if generic == p {
             param_bounds.push(*r);
         }
@@ -1518,8 +1517,8 @@ fn projection_bounds<'a,'tcx>(rcx: &Rcx<'a, 'tcx>,
     let tcx = fcx.tcx();
     let infcx = fcx.infcx();
 
-    debug!("projection_bounds(projection_ty={})",
-           projection_ty.repr());
+    debug!("projection_bounds(projection_ty={:?})",
+           projection_ty);
 
     let ty = ty::mk_projection(tcx, projection_ty.trait_ref.clone(), projection_ty.item_name);
 
@@ -1543,16 +1542,16 @@ fn projection_bounds<'a,'tcx>(rcx: &Rcx<'a, 'tcx>,
                 _ => { return None; }
             };
 
-            debug!("projection_bounds: outlives={} (1)",
-                   outlives.repr());
+            debug!("projection_bounds: outlives={:?} (1)",
+                   outlives);
 
             // apply the substitutions (and normalize any projected types)
             let outlives = fcx.instantiate_type_scheme(span,
                                                        projection_ty.trait_ref.substs,
                                                        &outlives);
 
-            debug!("projection_bounds: outlives={} (2)",
-                   outlives.repr());
+            debug!("projection_bounds: outlives={:?} (2)",
+                   outlives);
 
             let region_result = infcx.commit_if_ok(|_| {
                 let (outlives, _) =
@@ -1561,8 +1560,8 @@ fn projection_bounds<'a,'tcx>(rcx: &Rcx<'a, 'tcx>,
                         infer::AssocTypeProjection(projection_ty.item_name),
                         &outlives);
 
-                debug!("projection_bounds: outlives={} (3)",
-                       outlives.repr());
+                debug!("projection_bounds: outlives={:?} (3)",
+                       outlives);
 
                 // check whether this predicate applies to our current projection
                 match infer::mk_eqty(infcx, false, infer::Misc(span), ty, outlives.0) {
@@ -1571,8 +1570,8 @@ fn projection_bounds<'a,'tcx>(rcx: &Rcx<'a, 'tcx>,
                 }
             });
 
-            debug!("projection_bounds: region_result={}",
-                   region_result.repr());
+            debug!("projection_bounds: region_result={:?}",
+                   region_result);
 
             region_result.ok()
         })
index a5668d8e86053ef5548bd24b5377c2b1a2cc4b23..99e6309918c9728860f23de91cd4efafc41b10ab 100644 (file)
@@ -51,7 +51,6 @@
 use syntax::ast_util;
 use syntax::codemap::Span;
 use syntax::visit::{self, Visitor};
-use util::ppaux::Repr;
 
 ///////////////////////////////////////////////////////////////////////////
 // PUBLIC ENTRY POINTS
@@ -133,8 +132,8 @@ fn check_closure(&mut self,
         if !self.fcx.inh.closure_kinds.borrow().contains_key(&closure_def_id) {
             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());
+            debug!("check_closure: adding closure_id={:?} to closures_with_inferred_kinds",
+                   closure_def_id);
         }
 
         ty::with_freevars(self.tcx(), expr.id, |freevars| {
@@ -241,8 +240,8 @@ fn adjust_upvar_borrow_kind_for_consume(&self,
                                             cmt: mc::cmt<'tcx>,
                                             mode: euv::ConsumeMode)
     {
-        debug!("adjust_upvar_borrow_kind_for_consume(cmt={}, mode={:?})",
-               cmt.repr(), mode);
+        debug!("adjust_upvar_borrow_kind_for_consume(cmt={:?}, mode={:?})",
+               cmt, mode);
 
         // we only care about moves
         match mode {
@@ -254,8 +253,8 @@ fn adjust_upvar_borrow_kind_for_consume(&self,
         // for that to be legal, the upvar would have to be borrowed
         // by value instead
         let guarantor = cmt.guarantor();
-        debug!("adjust_upvar_borrow_kind_for_consume: guarantor={}",
-               guarantor.repr());
+        debug!("adjust_upvar_borrow_kind_for_consume: guarantor={:?}",
+               guarantor);
         match guarantor.cat {
             mc::cat_deref(_, _, mc::BorrowedPtr(..)) |
             mc::cat_deref(_, _, mc::Implicit(..)) => {
@@ -292,8 +291,8 @@ fn adjust_upvar_borrow_kind_for_consume(&self,
     /// to). If cmt contains any by-ref upvars, this implies that
     /// 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());
+        debug!("adjust_upvar_borrow_kind_for_mut(cmt={:?})",
+               cmt);
 
         match cmt.cat.clone() {
             mc::cat_deref(base, _, mc::Unique) |
@@ -326,8 +325,8 @@ 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());
+        debug!("adjust_upvar_borrow_kind_for_unique(cmt={:?})",
+               cmt);
 
         match cmt.cat.clone() {
             mc::cat_deref(base, _, mc::Unique) |
@@ -494,7 +493,7 @@ fn consume(&mut self,
                cmt: mc::cmt<'tcx>,
                mode: euv::ConsumeMode)
     {
-        debug!("consume(cmt={},mode={:?})", cmt.repr(), mode);
+        debug!("consume(cmt={:?},mode={:?})", cmt, mode);
         self.adjust_upvar_borrow_kind_for_consume(cmt, mode);
     }
 
@@ -509,7 +508,7 @@ fn consume_pat(&mut self,
                    cmt: mc::cmt<'tcx>,
                    mode: euv::ConsumeMode)
     {
-        debug!("consume_pat(cmt={},mode={:?})", cmt.repr(), mode);
+        debug!("consume_pat(cmt={:?},mode={:?})", cmt, mode);
         self.adjust_upvar_borrow_kind_for_consume(cmt, mode);
     }
 
@@ -521,8 +520,8 @@ fn borrow(&mut self,
               bk: ty::BorrowKind,
               _loan_cause: euv::LoanCause)
     {
-        debug!("borrow(borrow_id={}, cmt={}, bk={:?})",
-               borrow_id, cmt.repr(), bk);
+        debug!("borrow(borrow_id={}, cmt={:?}, bk={:?})",
+               borrow_id, cmt, bk);
 
         match bk {
             ty::ImmBorrow => { }
@@ -546,8 +545,8 @@ fn mutate(&mut self,
               assignee_cmt: mc::cmt<'tcx>,
               _mode: euv::MutateMode)
     {
-        debug!("mutate(assignee_cmt={})",
-               assignee_cmt.repr());
+        debug!("mutate(assignee_cmt={:?})",
+               assignee_cmt);
 
         self.adjust_upvar_borrow_kind_for_mut(assignee_cmt);
     }
index 7bcd3ddf59048abfa929c0f05bdced787d26e8c5..c048845892c4b7f1d364958bdc65526647da6d35 100644 (file)
@@ -18,7 +18,6 @@
 use middle::ty::{self, Ty};
 use middle::ty::liberate_late_bound_regions;
 use middle::ty_fold::{TypeFolder, TypeFoldable, super_fold_ty};
-use util::ppaux::{Repr, UserString};
 
 use std::collections::HashSet;
 use syntax::ast;
@@ -350,7 +349,7 @@ fn report_bivariance(&self,
                          param_name: ast::Name)
     {
         span_err!(self.tcx().sess, span, E0392,
-            "parameter `{}` is never used", param_name.user_string());
+            "parameter `{}` is never used", param_name);
 
         let suggested_marker_id = self.tcx().lang_items.phantom_data();
         match suggested_marker_id {
@@ -358,7 +357,7 @@ fn report_bivariance(&self,
                 self.tcx().sess.fileline_help(
                     span,
                     &format!("consider removing `{}` or using a marker such as `{}`",
-                             param_name.user_string(),
+                             param_name,
                              ty::item_path_str(self.tcx(), def_id)));
             }
             None => {
@@ -395,7 +394,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())
+                bounded_ty)
     }
 
     fn is_ty_param(ty: ty::Ty) -> bool {
@@ -543,16 +542,16 @@ fn fold_binder<T>(&mut self, binder: &ty::Binder<T>) -> ty::Binder<T>
             self.fcx.tcx(),
             region::DestructionScopeData::new(self.scope),
             binder);
-        debug!("BoundsChecker::fold_binder: late-bound regions replaced: {} at scope: {:?}",
-               value.repr(), self.scope);
+        debug!("BoundsChecker::fold_binder: late-bound regions replaced: {:?} at scope: {:?}",
+               value, self.scope);
         let value = value.fold_with(self);
         self.binding_count -= 1;
         ty::Binder(value)
     }
 
     fn fold_ty(&mut self, t: Ty<'tcx>) -> Ty<'tcx> {
-        debug!("BoundsChecker t={}",
-               t.repr());
+        debug!("BoundsChecker t={:?}",
+               t);
 
         match self.cache {
             Some(ref mut cache) => {
index 1be7e42b7170dc90d567611568cd1f1f6a47e8b5..05cc3077fc9fbb6d706fa2174d66cb8a5bdda35a 100644 (file)
@@ -21,7 +21,6 @@
 use middle::infer;
 use write_substs_to_tcx;
 use write_ty_to_tcx;
-use util::ppaux::Repr;
 
 use std::cell::Cell;
 
@@ -169,10 +168,10 @@ fn visit_pat(&mut self, p: &ast::Pat) {
 
         self.visit_node_id(ResolvingPattern(p.span), p.id);
 
-        debug!("Type for pattern binding {} (id {}) resolved to {}",
+        debug!("Type for pattern binding {} (id {}) resolved to {:?}",
                pat_to_string(p),
                p.id,
-               ty::node_id_to_type(self.tcx(), p.id).repr());
+               ty::node_id_to_type(self.tcx(), p.id));
 
         visit::walk_pat(self, p);
     }
@@ -215,9 +214,9 @@ fn visit_upvar_borrow_map(&self) {
                         ty::UpvarBorrow { kind: upvar_borrow.kind, region: r })
                 }
             };
-            debug!("Upvar capture for {} resolved to {}",
-                   upvar_id.repr(),
-                   new_upvar_capture.repr());
+            debug!("Upvar capture for {:?} resolved to {:?}",
+                   upvar_id,
+                   new_upvar_capture);
             self.fcx.tcx().upvar_capture_map.borrow_mut().insert(*upvar_id, new_upvar_capture);
         }
     }
@@ -245,7 +244,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());
+        debug!("Node {} has type {:?}", id, n_ty);
 
         // Resolve any substitutions
         self.fcx.opt_node_ty_substs(id, |item_substs| {
@@ -294,9 +293,9 @@ fn visit_method_map_entry(&self,
         // Resolve any method map entry
         match self.fcx.inh.method_map.borrow_mut().remove(&method_call) {
             Some(method) => {
-                debug!("writeback::resolve_method_map_entry(call={:?}, entry={})",
+                debug!("writeback::resolve_method_map_entry(call={:?}, entry={:?})",
                        method_call,
-                       method.repr());
+                       method);
                 let new_method = MethodCallee {
                     origin: self.resolve(&method.origin, reason),
                     ty: self.resolve(&method.ty, reason),
@@ -427,8 +426,8 @@ fn fold_ty(&mut self, t: Ty<'tcx>) -> Ty<'tcx> {
         match self.infcx.fully_resolve(&t) {
             Ok(t) => t,
             Err(e) => {
-                debug!("Resolver::fold_ty: input type `{}` not fully resolvable",
-                       t.repr());
+                debug!("Resolver::fold_ty: input type `{:?}` not fully resolvable",
+                       t);
                 self.report_error(e);
                 self.tcx().types.err
             }
index 59b57a492649196c9c45de761d174719a6303e42..b66c76048c639db3b0e7531602e3a6396f59c8cb 100644 (file)
@@ -44,7 +44,6 @@
 use syntax::parse::token;
 use syntax::visit;
 use util::nodemap::{DefIdMap, FnvHashMap};
-use util::ppaux::Repr;
 
 mod orphan;
 mod overlap;
@@ -82,7 +81,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()));
+                         ty));
         }
     }
 }
@@ -149,9 +148,9 @@ 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(),
-                   token::get_ident(item.ident));
+            debug!("(checking implementation) adding impl for trait '{:?}', item '{}'",
+                   trait_ref,
+                   item.ident);
 
             enforce_trait_manually_implementable(self.crate_context.tcx,
                                                  item.span,
@@ -179,8 +178,8 @@ fn instantiate_default_methods(
             trait_ref: &ty::TraitRef<'tcx>,
             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());
+        debug!("instantiate_default_methods(impl_id={:?}, trait_ref={:?})",
+               impl_id, trait_ref);
 
         let impl_type_scheme = ty::lookup_item_type(tcx, impl_id);
 
@@ -190,7 +189,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());
+            debug!("new_did={:?} trait_method={:?}", new_did, trait_method);
 
             // Create substitutions for the various trait parameters.
             let new_method_ty =
@@ -203,7 +202,7 @@ fn instantiate_default_methods(
                     &**trait_method,
                     Some(trait_method.def_id)));
 
-            debug!("new_method_ty={}", new_method_ty.repr());
+            debug!("new_method_ty={:?}", new_method_ty);
             all_impl_items.push(MethodTraitItemId(new_did));
 
             // construct the polytype for the method based on the
@@ -214,7 +213,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());
+            debug!("new_polytype={:?}", new_polytype);
 
             tcx.tcache.borrow_mut().insert(new_did, new_polytype);
             tcx.predicates.borrow_mut().insert(new_did, new_method_ty.predicates.clone());
@@ -360,8 +359,8 @@ fn check_implementations_of_copy(&self) {
         let copy_trait = ty::lookup_trait_def(tcx, copy_trait);
 
         copy_trait.for_each_impl(tcx, |impl_did| {
-            debug!("check_implementations_of_copy: impl_did={}",
-                   impl_did.repr());
+            debug!("check_implementations_of_copy: impl_did={:?}",
+                   impl_did);
 
             if impl_did.krate != ast::LOCAL_CRATE {
                 debug!("check_implementations_of_copy(): impl not in this \
@@ -370,16 +369,16 @@ 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());
+            debug!("check_implementations_of_copy: self_type={:?} (bound)",
+                   self_type);
 
             let span = tcx.map.span(impl_did.node);
             let param_env = ParameterEnvironment::for_item(tcx, impl_did.node);
             let self_type = self_type.ty.subst(tcx, &param_env.free_substs);
             assert!(!self_type.has_escaping_regions());
 
-            debug!("check_implementations_of_copy: self_type={} (free)",
-                   self_type.repr());
+            debug!("check_implementations_of_copy: self_type={:?} (free)",
+                   self_type);
 
             match ty::can_type_implement_copy(&param_env, span, self_type) {
                 Ok(()) => {}
@@ -429,8 +428,8 @@ fn check_implementations_of_coerce_unsized(&self) {
         let trait_def = ty::lookup_trait_def(tcx, coerce_unsized_trait);
 
         trait_def.for_each_impl(tcx, |impl_did| {
-            debug!("check_implementations_of_coerce_unsized: impl_did={}",
-                   impl_did.repr());
+            debug!("check_implementations_of_coerce_unsized: impl_did={:?}",
+                   impl_did);
 
             if impl_did.krate != ast::LOCAL_CRATE {
                 debug!("check_implementations_of_coerce_unsized(): impl not \
@@ -442,8 +441,8 @@ fn check_implementations_of_coerce_unsized(&self) {
             let trait_ref = ty::impl_trait_ref(self.crate_context.tcx,
                                                impl_did).unwrap();
             let target = *trait_ref.substs.types.get(subst::TypeSpace, 0);
-            debug!("check_implementations_of_coerce_unsized: {} -> {} (bound)",
-                   source.repr(), target.repr());
+            debug!("check_implementations_of_coerce_unsized: {:?} -> {:?} (bound)",
+                   source, target);
 
             let span = tcx.map.span(impl_did.node);
             let param_env = ParameterEnvironment::for_item(tcx, impl_did.node);
@@ -451,8 +450,8 @@ fn check_implementations_of_coerce_unsized(&self) {
             let target = target.subst(tcx, &param_env.free_substs);
             assert!(!source.has_escaping_regions());
 
-            debug!("check_implementations_of_coerce_unsized: {} -> {} (free)",
-                   source.repr(), target.repr());
+            debug!("check_implementations_of_coerce_unsized: {:?} -> {:?} (free)",
+                   source, target);
 
             let infcx = new_infer_ctxt(tcx);
 
@@ -518,10 +517,8 @@ fn check_implementations_of_coerce_unsized(&self) {
                                                 if name == token::special_names::unnamed_field {
                                                     i.to_string()
                                                 } else {
-                                                    token::get_name(name).to_string()
-                                                },
-                                                a.repr(),
-                                                b.repr())
+                                                    name.to_string()
+                                                }, a, b)
                                    }).collect::<Vec<_>>().connect(", "));
                         return;
                     }
@@ -597,8 +594,8 @@ 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());
+    debug!("subst_receiver_types_in_method_ty: combined_substs={:?}",
+           combined_substs);
 
     let method_predicates = method.predicates.subst(tcx, &combined_substs);
     let mut method_generics = method.generics.subst(tcx, &combined_substs);
@@ -614,13 +611,13 @@ fn subst_receiver_types_in_method_ty<'tcx>(tcx: &ty::ctxt<'tcx>,
             impl_type_scheme.generics.regions.get_slice(space).to_vec());
     }
 
-    debug!("subst_receiver_types_in_method_ty: method_generics={}",
-           method_generics.repr());
+    debug!("subst_receiver_types_in_method_ty: method_generics={:?}",
+           method_generics);
 
     let method_fty = method.fty.subst(tcx, &combined_substs);
 
-    debug!("subst_receiver_types_in_method_ty: method_ty={}",
-           method.fty.repr());
+    debug!("subst_receiver_types_in_method_ty: method_ty={:?}",
+           method.fty);
 
     ty::Method::new(
         method.name,
index 3068bb9923dd0ded573ea33a069cb46f0b0155b0..8376b92da3dea667c3926ad14c169d0b7de6af51 100644 (file)
@@ -18,7 +18,6 @@
 use syntax::ast_util;
 use syntax::codemap::Span;
 use syntax::visit;
-use util::ppaux::{Repr, UserString};
 
 pub fn check(tcx: &ty::ctxt) {
     let mut orphan = OrphanChecker { tcx: tcx };
@@ -229,7 +228,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());
+                                param_ty);
                         return;
                     }
                 }
@@ -267,9 +266,9 @@ fn check_item(&self, item: &ast::Item) {
                 // This final impl is legal according to the orpan
                 // rules, but it invalidates the reasoning from
                 // `two_foos` above.
-                debug!("trait_ref={} trait_def_id={} trait_has_default_impl={}",
-                       trait_ref.repr(),
-                       trait_def_id.repr(),
+                debug!("trait_ref={:?} trait_def_id={:?} trait_has_default_impl={}",
+                       trait_ref,
+                       trait_def_id,
                        ty::trait_has_default_impl(self.tcx, trait_def_id));
                 if
                     ty::trait_has_default_impl(self.tcx, trait_def_id) &&
@@ -307,7 +306,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_ty))
                         }
                     };
 
index 74ce9ed540ecbabae4e8a323486fda6d64d22dff..0e8067e7181bd4d821ce364639c46710c384b2b0 100644 (file)
@@ -21,7 +21,6 @@
 use syntax::visit;
 use syntax::codemap::Span;
 use util::nodemap::DefIdMap;
-use util::ppaux::{Repr, UserString};
 
 pub fn check(tcx: &ty::ctxt) {
     let mut overlap = OverlapChecker { tcx: tcx, default_impls: DefIdMap() };
@@ -61,8 +60,8 @@ fn check_for_overlapping_impls(&self) {
     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());
+        debug!("check_for_overlapping_impls_of_trait(trait_def={:?})",
+               trait_def);
 
         // We should already know all impls of this trait, so these
         // borrows are safe.
@@ -131,10 +130,10 @@ fn check_if_impls_overlap(&self,
         if let Some((impl1_def_id, impl2_def_id)) = self.order_impls(
             impl1_def_id, impl2_def_id)
         {
-            debug!("check_if_impls_overlap({}, {}, {})",
-                   trait_def_id.repr(),
-                   impl1_def_id.repr(),
-                   impl2_def_id.repr());
+            debug!("check_if_impls_overlap({:?}, {:?}, {:?})",
+                   trait_def_id,
+                   impl1_def_id,
+                   impl2_def_id);
 
             let infcx = infer::new_infer_ctxt(self.tcx);
             if traits::overlapping_impls(&infcx, impl1_def_id, impl2_def_id) {
@@ -217,7 +216,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(),
+                                          trait_ref.self_ty(),
                                           ty::item_path_str(self.tcx, trait_def_id));
                             }
                         }
index fe276b3d1bdedc1be15a519c942fc3ca6fdc8582..fa39e9d0491f9566136934475229e627fdd18897 100644 (file)
@@ -16,7 +16,6 @@
 use syntax::ast;
 use syntax::ast_util;
 use syntax::visit;
-use util::ppaux::UserString;
 
 pub fn check(tcx: &ty::ctxt) {
     let mut orphan = UnsafetyChecker { tcx: tcx };
@@ -55,14 +54,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());
+                                  trait_ref);
                     }
 
                     (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());
+                                  trait_ref);
                     }
 
                     (ast::Unsafety::Unsafe,
index 9987b884cf282143f79a2c5f4a855f7598b18c2f..13d2cf25e0665352106c7a28c26440666dc0c04f 100644 (file)
@@ -80,7 +80,6 @@
 use rustc::ast_map;
 use util::common::{ErrorReported, memoized};
 use util::nodemap::{FnvHashMap, FnvHashSet};
-use util::ppaux::{Repr, UserString};
 use write_ty_to_tcx;
 
 use std::cell::{Cell, RefCell};
@@ -255,7 +254,7 @@ fn report_cycle(&self,
                 tcx.sess.note(
                     &format!("the cycle begins when computing the bounds \
                               for type parameter `{}`...",
-                             def.name.user_string()));
+                             def.name));
             }
         }
 
@@ -277,7 +276,7 @@ fn report_cycle(&self,
                     tcx.sess.note(
                         &format!("...which then requires computing the bounds \
                                   for type parameter `{}`...",
-                                 def.name.user_string()));
+                                 def.name));
                 }
             }
         }
@@ -300,7 +299,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()));
+                             def.name));
             }
         }
     }
@@ -317,7 +316,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.sess.bug(&format!("get_trait_def({:?}): not an item", trait_id))
         };
 
         trait_def_of_item(self, &*item)
@@ -371,8 +370,8 @@ fn ensure_super_predicates(&self,
                                trait_def_id: ast::DefId)
                                -> Result<(), ErrorReported>
     {
-        debug!("ensure_super_predicates(trait_def_id={})",
-               trait_def_id.repr());
+        debug!("ensure_super_predicates(trait_def_id={:?})",
+               trait_def_id);
 
         self.ccx.ensure_super_predicates(span, trait_def_id)
     }
@@ -634,8 +633,8 @@ 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, id, fty.repr());
+    debug!("method {} (id {}) has type {:?}",
+            ident, id, fty);
     ccx.tcx.tcache.borrow_mut().insert(def_id,TypeScheme {
         generics: ty_method.generics.clone(),
         ty: fty
@@ -644,8 +643,8 @@ 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());
+    debug!("writing method type: def_id={:?} mty={:?}",
+            def_id, ty_method);
 
     ccx.tcx.impl_or_trait_items.borrow_mut().insert(def_id,
         ty::MethodTraitItem(Rc::new(ty_method)));
@@ -742,10 +741,11 @@ fn convert_methods<'a,'tcx,'i,I>(ccx: &CrateCtxt<'a, 'tcx>,
                                  rcvr_ty_predicates: &ty::GenericPredicates<'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(),
-           rcvr_ty_generics.repr(),
-           rcvr_ty_predicates.repr());
+    debug!("convert_methods(untransformed_rcvr_ty={:?}, rcvr_ty_generics={:?}, \
+                            rcvr_ty_predicates={:?})",
+           untransformed_rcvr_ty,
+           rcvr_ty_generics,
+           rcvr_ty_predicates);
 
     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());
+    debug!("ensure_super_predicates_step(trait_def_id={:?})", trait_def_id);
 
     if trait_def_id.krate != ast::LOCAL_CRATE {
         // If this trait comes from an external crate, then all of the
@@ -1191,9 +1191,9 @@ fn ensure_super_predicates_step(ccx: &CrateCtxt,
         let superpredicates = ty::GenericPredicates {
             predicates: VecPerParamSpace::new(superbounds, vec![], vec![])
         };
-        debug!("superpredicates for trait {} = {}",
-               local_def(item.id).repr(),
-               superpredicates.repr());
+        debug!("superpredicates for trait {:?} = {:?}",
+               local_def(item.id),
+               superpredicates);
 
         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());
+    debug!("ensure_super_predicates_step: def_ids={:?}", def_ids);
 
     def_ids
 }
@@ -1532,9 +1532,8 @@ 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(),
-                                     d =>
-                                         d.repr(),
+                                         r.to_string(),
+                                     d => format!("{:?}", d),
                                  })
                                  .collect::<Vec<String>>()
                                  .connect(",");
@@ -1620,8 +1619,8 @@ fn ty_generics_for_trait<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
                                    ast_generics: &ast::Generics)
                                    -> ty::Generics<'tcx>
 {
-    debug!("ty_generics_for_trait(trait_id={}, substs={})",
-           local_def(trait_id).repr(), substs.repr());
+    debug!("ty_generics_for_trait(trait_id={:?}, substs={:?})",
+           local_def(trait_id), substs);
 
     let mut generics = ty_generics_for_type_or_impl(ccx, ast_generics);
 
@@ -2200,12 +2199,12 @@ fn check_method_self_type<'a, 'tcx, RS:RegionScope>(
                 &ty::liberate_late_bound_regions(
                     tcx, body_scope, &ty::Binder(base_type)));
 
-        debug!("required_type={} required_type_free={} \
-                base_type={} base_type_free={}",
-               required_type.repr(),
-               required_type_free.repr(),
-               base_type.repr(),
-               base_type_free.repr());
+        debug!("required_type={:?} required_type_free={:?} \
+                base_type={:?} base_type_free={:?}",
+               required_type,
+               required_type_free,
+               base_type,
+               base_type_free);
 
         let infcx = infer::new_infer_ctxt(tcx);
         drop(::require_same_types(tcx,
@@ -2216,7 +2215,7 @@ fn check_method_self_type<'a, 'tcx, RS:RegionScope>(
                                   required_type_free,
                                   || {
                 format!("mismatched self type: expected `{}`",
-                         required_type.user_string())
+                         required_type)
         }));
 
         // We could conceviably add more free-region relations here,
@@ -2286,7 +2285,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());
+            report_unused_parameter(tcx, ty_param.span, "type", &param_ty.to_string());
         }
     }
 
@@ -2316,7 +2315,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());
+                                    "lifetime", &region.name.to_string());
         }
     }
 
index b56bb895b9ed69f77a797e97193596c2083af1b9..8feecd15613119931074cec6ad343c157bedb675 100644 (file)
 use rustc::ast_map;
 use session::config;
 use util::common::time;
-use util::ppaux::{Repr, UserString};
 
 use syntax::codemap::Span;
 use syntax::print::pprust::*;
@@ -148,7 +147,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());
+    debug!("write_ty_to_tcx({}, {:?})", node_id,  ty);
     assert!(!ty::type_needs_infer(ty));
     tcx.node_type_insert(node_id, ty);
 }
@@ -157,9 +156,9 @@ fn write_substs_to_tcx<'tcx>(tcx: &ty::ctxt<'tcx>,
                                  node_id: ast::NodeId,
                                  item_substs: ty::ItemSubsts<'tcx>) {
     if !item_substs.is_noop() {
-        debug!("write_substs_to_tcx({}, {})",
+        debug!("write_substs_to_tcx({}, {:?})",
                node_id,
-               item_substs.repr());
+               item_substs);
 
         assert!(item_substs.substs.types.all(|t| !ty::type_needs_infer(*t)));
 
@@ -240,14 +239,13 @@ 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())
+                             se_ty)
                 });
         }
         _ => {
             tcx.sess.span_bug(main_span,
-                              &format!("main has a non-function type: found \
-                                       `{}`",
-                                      main_t.repr()));
+                              &format!("main has a non-function type: found `{}`",
+                                       main_t));
         }
     }
 }
@@ -290,15 +288,14 @@ 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())
+                             se_ty)
                 });
 
         }
         _ => {
             tcx.sess.span_bug(start_span,
-                              &format!("start has a non-function type: found \
-                                       `{}`",
-                                       start_t.repr()));
+                              &format!("start has a non-function type: found `{}`",
+                                       start_t));
         }
     }
 }
index 91ec676c09521b2934e26c9bae3eadebe81586b5..1f4e13436512179f729084b162d2d566b81e2a33 100644 (file)
 use syntax::visit;
 use syntax::visit::Visitor;
 use util::nodemap::NodeMap;
-use util::ppaux::Repr;
 
 pub fn infer_variance(tcx: &ty::ctxt) {
     let krate = tcx.map.krate();
@@ -845,8 +844,8 @@ fn add_constraints_from_trait_ref(&mut self,
                                       generics: &ty::Generics<'tcx>,
                                       trait_ref: ty::TraitRef<'tcx>,
                                       variance: VarianceTermPtr<'a>) {
-        debug!("add_constraints_from_trait_ref: trait_ref={} variance={:?}",
-               trait_ref.repr(),
+        debug!("add_constraints_from_trait_ref: trait_ref={:?} variance={:?}",
+               trait_ref,
                variance);
 
         let trait_def = ty::lookup_trait_def(self.tcx(), trait_ref.def_id);
@@ -867,8 +866,8 @@ fn add_constraints_from_ty(&mut self,
                                generics: &ty::Generics<'tcx>,
                                ty: Ty<'tcx>,
                                variance: VarianceTermPtr<'a>) {
-        debug!("add_constraints_from_ty(ty={}, variance={:?})",
-               ty.repr(),
+        debug!("add_constraints_from_ty(ty={:?}, variance={:?})",
+               ty,
                variance);
 
         match ty.sty {
@@ -981,8 +980,7 @@ fn add_constraints_from_ty(&mut self,
             ty::TyInfer(..) => {
                 self.tcx().sess.bug(
                     &format!("unexpected type encountered in \
-                            variance inference: {}",
-                            ty.repr()));
+                              variance inference: {}", ty));
             }
         }
     }
@@ -997,9 +995,9 @@ fn add_constraints_from_substs(&mut self,
                                    region_param_defs: &[ty::RegionParameterDef],
                                    substs: &subst::Substs<'tcx>,
                                    variance: VarianceTermPtr<'a>) {
-        debug!("add_constraints_from_substs(def_id={}, substs={}, variance={:?})",
-               def_id.repr(),
-               substs.repr(),
+        debug!("add_constraints_from_substs(def_id={:?}, substs={:?}, variance={:?})",
+               def_id,
+               substs,
                variance);
 
         for p in type_param_defs {
@@ -1066,8 +1064,8 @@ fn add_constraints_from_region(&mut self,
                 self.tcx()
                     .sess
                     .bug(&format!("unexpected region encountered in variance \
-                                  inference: {}",
-                                 region.repr()));
+                                  inference: {:?}",
+                                 region));
             }
         }
     }
@@ -1194,17 +1192,16 @@ fn write(&self) {
                 types: types,
                 regions: regions
             };
-            debug!("item_id={} item_variances={}",
+            debug!("item_id={} item_variances={:?}",
                     item_id,
-                    item_variances.repr());
+                    item_variances);
 
             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();
-                span_err!(tcx.sess, tcx.map.span(item_id), E0208, "{}", &found[..]);
+                span_err!(tcx.sess, tcx.map.span(item_id), E0208, "{:?}", item_variances);
             }
 
             let newly_added = tcx.item_variance_map.borrow_mut()