Skip to content

Commit 943a884

Browse files
committed
---
yaml --- r: 213224 b: refs/heads/auto c: 96ad4a4 h: refs/heads/master v: v3
1 parent 0629629 commit 943a884

File tree

29 files changed

+134
-153
lines changed

29 files changed

+134
-153
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1010
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1111
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1212
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
13-
refs/heads/auto: 4e0cb86a5c173096b08819af37f57970ac332561
13+
refs/heads/auto: 96ad4a486381497da00ad12413bfc0fbac201189
1414
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1515
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1616
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/src/librustc/middle/astencode.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ use middle::privacy::{AllPublic, LastMod};
3131
use middle::subst;
3232
use middle::subst::VecPerParamSpace;
3333
use middle::ty::{self, Ty, MethodCall, MethodCallee, MethodOrigin};
34-
use util::ppaux::ty_to_string;
34+
use util::ppaux::Repr;
3535

3636
use syntax::{ast, ast_util, codemap, fold};
3737
use syntax::codemap::Span;
@@ -1624,7 +1624,7 @@ fn decode_side_tables(dcx: &DecodeContext,
16241624
c::tag_table_node_type => {
16251625
let ty = val_dsr.read_ty(dcx);
16261626
debug!("inserting ty for node {}: {}",
1627-
id, ty_to_string(dcx.tcx, ty));
1627+
id, ty.repr(dcx.tcx));
16281628
dcx.tcx.node_type_insert(id, ty);
16291629
}
16301630
c::tag_table_item_subst => {

branches/auto/src/librustc/middle/check_match.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ use syntax::print::pprust::pat_to_string;
3636
use syntax::parse::token;
3737
use syntax::ptr::P;
3838
use syntax::visit::{self, Visitor, FnKind};
39-
use util::ppaux::ty_to_string;
39+
use util::ppaux::UserString;
4040
use util::nodemap::FnvHashMap;
4141

4242
pub const DUMMY_WILD_PAT: &'static Pat = &Pat {
@@ -209,9 +209,8 @@ fn check_expr(cx: &mut MatchCheckCtxt, ex: &ast::Expr) {
209209
if !type_is_empty(cx.tcx, pat_ty) {
210210
// We know the type is inhabited, so this must be wrong
211211
span_err!(cx.tcx.sess, ex.span, E0002,
212-
"non-exhaustive patterns: type {} is non-empty",
213-
ty_to_string(cx.tcx, pat_ty)
214-
);
212+
"non-exhaustive patterns: type {} is non-empty",
213+
pat_ty.user_string(cx.tcx));
215214
}
216215
// If the type *is* empty, it's vacuously exhaustive
217216
return;
@@ -244,11 +243,11 @@ fn check_for_bindings_named_the_same_as_variants(cx: &MatchCheckCtxt, pat: &Pat)
244243
span_warn!(cx.tcx.sess, p.span, E0170,
245244
"pattern binding `{}` is named the same as one \
246245
of the variants of the type `{}`",
247-
&token::get_ident(ident.node), ty_to_string(cx.tcx, pat_ty));
246+
&token::get_ident(ident.node), pat_ty.user_string(cx.tcx));
248247
fileline_help!(cx.tcx.sess, p.span,
249248
"if you meant to match on a variant, \
250249
consider making the path in the pattern qualified: `{}::{}`",
251-
ty_to_string(cx.tcx, pat_ty), &token::get_ident(ident.node));
250+
pat_ty.user_string(cx.tcx), &token::get_ident(ident.node));
252251
}
253252
}
254253
}

branches/auto/src/librustc/middle/check_rvalues.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use middle::expr_use_visitor as euv;
1515
use middle::mem_categorization as mc;
1616
use middle::ty::ParameterEnvironment;
1717
use middle::ty;
18-
use util::ppaux::ty_to_string;
18+
use util::ppaux::{Repr, UserString};
1919

2020
use syntax::ast;
2121
use syntax::codemap::Span;
@@ -59,11 +59,11 @@ impl<'a, 'tcx> euv::Delegate<'tcx> for RvalueContextDelegate<'a, 'tcx> {
5959
span: Span,
6060
cmt: mc::cmt<'tcx>,
6161
_: euv::ConsumeMode) {
62-
debug!("consume; cmt: {:?}; type: {}", *cmt, ty_to_string(self.tcx, cmt.ty));
62+
debug!("consume; cmt: {:?}; type: {}", *cmt, cmt.ty.repr(self.tcx));
6363
if !ty::type_is_sized(Some(self.param_env), self.tcx, span, cmt.ty) {
6464
span_err!(self.tcx.sess, span, E0161,
6565
"cannot move a value of type {0}: the size of {0} cannot be statically determined",
66-
ty_to_string(self.tcx, cmt.ty));
66+
cmt.ty.user_string(self.tcx));
6767
}
6868
}
6969

branches/auto/src/librustc/middle/effect.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use self::UnsafeContext::*;
1515
use middle::def;
1616
use middle::ty::{self, Ty};
1717
use middle::ty::MethodCall;
18-
use util::ppaux;
18+
use util::ppaux::Repr;
1919

2020
use syntax::ast;
2121
use syntax::codemap::Span;
@@ -67,7 +67,7 @@ impl<'a, 'tcx> EffectCheckVisitor<'a, 'tcx> {
6767
_ => return
6868
};
6969
debug!("effect: checking index with base type {}",
70-
ppaux::ty_to_string(self.tcx, base_type));
70+
base_type.repr(self.tcx));
7171
match base_type.sty {
7272
ty::TyBox(ty) | ty::TyRef(_, ty::mt{ty, ..}) => if ty::TyStr == ty.sty {
7373
span_err!(self.tcx.sess, e.span, E0134,
@@ -143,7 +143,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for EffectCheckVisitor<'a, 'tcx> {
143143
let method_call = MethodCall::expr(expr.id);
144144
let base_type = self.tcx.method_map.borrow().get(&method_call).unwrap().ty;
145145
debug!("effect: method call case, base type is {}",
146-
ppaux::ty_to_string(self.tcx, base_type));
146+
base_type.repr(self.tcx));
147147
if type_is_unsafe_function(base_type) {
148148
self.require_unsafe(expr.span,
149149
"invocation of unsafe method")
@@ -152,15 +152,15 @@ impl<'a, 'tcx, 'v> Visitor<'v> for EffectCheckVisitor<'a, 'tcx> {
152152
ast::ExprCall(ref base, _) => {
153153
let base_type = ty::node_id_to_type(self.tcx, base.id);
154154
debug!("effect: call case, base type is {}",
155-
ppaux::ty_to_string(self.tcx, base_type));
155+
base_type.repr(self.tcx));
156156
if type_is_unsafe_function(base_type) {
157157
self.require_unsafe(expr.span, "call to unsafe function")
158158
}
159159
}
160160
ast::ExprUnary(ast::UnDeref, ref base) => {
161161
let base_type = ty::node_id_to_type(self.tcx, base.id);
162162
debug!("effect: unary case, base type is {}",
163-
ppaux::ty_to_string(self.tcx, base_type));
163+
base_type.repr(self.tcx));
164164
if let ty::TyRawPtr(_) = base_type.sty {
165165
self.require_unsafe(expr.span, "dereference of raw pointer")
166166
}

branches/auto/src/librustc/middle/infer/mod.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ use syntax::ast;
3636
use syntax::codemap;
3737
use syntax::codemap::Span;
3838
use util::nodemap::FnvHashMap;
39-
use util::ppaux::ty_to_string;
4039
use util::ppaux::{Repr, UserString};
4140

4241
use self::combine::CombineFields;
@@ -862,8 +861,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
862861
}
863862

864863
pub fn ty_to_string(&self, t: Ty<'tcx>) -> String {
865-
ty_to_string(self.tcx,
866-
self.resolve_type_vars_if_possible(&t))
864+
self.resolve_type_vars_if_possible(&t).user_string(self.tcx)
867865
}
868866

869867
pub fn tys_to_string(&self, ts: &[Ty<'tcx>]) -> String {

branches/auto/src/librustc/middle/ty.rs

Lines changed: 21 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ use middle::ty;
6262
use middle::ty_fold::{self, TypeFoldable, TypeFolder};
6363
use middle::ty_walk::{self, TypeWalker};
6464
use util::ppaux::note_and_explain_region;
65-
use util::ppaux::ty_to_string;
6665
use util::ppaux::{Repr, UserString};
6766
use util::common::{memoized, ErrorReported};
6867
use util::nodemap::{NodeMap, NodeSet, DefIdMap, DefIdSet};
@@ -3568,7 +3567,7 @@ pub fn sequence_element_type<'tcx>(cx: &ctxt<'tcx>, ty: Ty<'tcx>) -> Ty<'tcx> {
35683567
TyArray(ty, _) | TySlice(ty) => ty,
35693568
TyStr => mk_mach_uint(cx, ast::TyU8),
35703569
_ => cx.sess.bug(&format!("sequence_element_type called on non-sequence value: {}",
3571-
ty_to_string(cx, ty))),
3570+
ty.user_string(cx))),
35723571
}
35733572
}
35743573

@@ -4139,24 +4138,20 @@ pub fn is_ffi_safe<'tcx>(cx: &ctxt<'tcx>, ty: Ty<'tcx>) -> bool {
41394138
pub fn is_instantiable<'tcx>(cx: &ctxt<'tcx>, r_ty: Ty<'tcx>) -> bool {
41404139
fn type_requires<'tcx>(cx: &ctxt<'tcx>, seen: &mut Vec<DefId>,
41414140
r_ty: Ty<'tcx>, ty: Ty<'tcx>) -> bool {
4142-
debug!("type_requires({:?}, {:?})?",
4143-
::util::ppaux::ty_to_string(cx, r_ty),
4144-
::util::ppaux::ty_to_string(cx, ty));
4141+
debug!("type_requires({}, {})?",
4142+
r_ty.repr(cx), ty.repr(cx));
41454143

41464144
let r = r_ty == ty || subtypes_require(cx, seen, r_ty, ty);
41474145

4148-
debug!("type_requires({:?}, {:?})? {:?}",
4149-
::util::ppaux::ty_to_string(cx, r_ty),
4150-
::util::ppaux::ty_to_string(cx, ty),
4151-
r);
4146+
debug!("type_requires({}, {})? {:?}",
4147+
r_ty.repr(cx), ty.repr(cx), r);
41524148
return r;
41534149
}
41544150

41554151
fn subtypes_require<'tcx>(cx: &ctxt<'tcx>, seen: &mut Vec<DefId>,
41564152
r_ty: Ty<'tcx>, ty: Ty<'tcx>) -> bool {
4157-
debug!("subtypes_require({:?}, {:?})?",
4158-
::util::ppaux::ty_to_string(cx, r_ty),
4159-
::util::ppaux::ty_to_string(cx, ty));
4153+
debug!("subtypes_require({}, {})?",
4154+
r_ty.repr(cx), ty.repr(cx));
41604155

41614156
let r = match ty.sty {
41624157
// fixed length vectors need special treatment compared to
@@ -4234,10 +4229,8 @@ pub fn is_instantiable<'tcx>(cx: &ctxt<'tcx>, r_ty: Ty<'tcx>) -> bool {
42344229
}
42354230
};
42364231

4237-
debug!("subtypes_require({:?}, {:?})? {:?}",
4238-
::util::ppaux::ty_to_string(cx, r_ty),
4239-
::util::ppaux::ty_to_string(cx, ty),
4240-
r);
4232+
debug!("subtypes_require({}, {})? {:?}",
4233+
r_ty.repr(cx), ty.repr(cx), r);
42414234

42424235
return r;
42434236
}
@@ -4343,8 +4336,7 @@ pub fn is_type_representable<'tcx>(cx: &ctxt<'tcx>, sp: Span, ty: Ty<'tcx>)
43434336
fn is_type_structurally_recursive<'tcx>(cx: &ctxt<'tcx>, sp: Span,
43444337
seen: &mut Vec<Ty<'tcx>>,
43454338
ty: Ty<'tcx>) -> Representability {
4346-
debug!("is_type_structurally_recursive: {:?}",
4347-
::util::ppaux::ty_to_string(cx, ty));
4339+
debug!("is_type_structurally_recursive: {}", ty.repr(cx));
43484340

43494341
match ty.sty {
43504342
TyStruct(did, _) | TyEnum(did, _) => {
@@ -4363,9 +4355,9 @@ pub fn is_type_representable<'tcx>(cx: &ctxt<'tcx>, sp: Span, ty: Ty<'tcx>)
43634355
match iter.next() {
43644356
Some(&seen_type) => {
43654357
if same_struct_or_enum_def_id(seen_type, did) {
4366-
debug!("SelfRecursive: {:?} contains {:?}",
4367-
::util::ppaux::ty_to_string(cx, seen_type),
4368-
::util::ppaux::ty_to_string(cx, ty));
4358+
debug!("SelfRecursive: {} contains {}",
4359+
seen_type.repr(cx),
4360+
ty.repr(cx));
43694361
return SelfRecursive;
43704362
}
43714363
}
@@ -4383,9 +4375,9 @@ pub fn is_type_representable<'tcx>(cx: &ctxt<'tcx>, sp: Span, ty: Ty<'tcx>)
43834375

43844376
for &seen_type in iter {
43854377
if same_type(ty, seen_type) {
4386-
debug!("ContainsRecursive: {:?} contains {:?}",
4387-
::util::ppaux::ty_to_string(cx, seen_type),
4388-
::util::ppaux::ty_to_string(cx, ty));
4378+
debug!("ContainsRecursive: {} contains {}",
4379+
seen_type.repr(cx),
4380+
ty.repr(cx));
43894381
return ContainsRecursive;
43904382
}
43914383
}
@@ -4405,16 +4397,14 @@ pub fn is_type_representable<'tcx>(cx: &ctxt<'tcx>, sp: Span, ty: Ty<'tcx>)
44054397
}
44064398
}
44074399

4408-
debug!("is_type_representable: {:?}",
4409-
::util::ppaux::ty_to_string(cx, ty));
4400+
debug!("is_type_representable: {}", ty.repr(cx));
44104401

44114402
// To avoid a stack overflow when checking an enum variant or struct that
44124403
// contains a different, structurally recursive type, maintain a stack
44134404
// of seen types and check recursion for each of them (issues #3008, #3779).
44144405
let mut seen: Vec<Ty> = Vec::new();
44154406
let r = is_type_structurally_recursive(cx, sp, &mut seen, ty);
4416-
debug!("is_type_representable: {:?} is {:?}",
4417-
::util::ppaux::ty_to_string(cx, ty), r);
4407+
debug!("is_type_representable: {} is {:?}", ty.repr(cx), r);
44184408
r
44194409
}
44204410

@@ -4857,7 +4847,7 @@ pub fn adjust_ty<'tcx, F>(cx: &ctxt<'tcx>,
48574847
span,
48584848
&format!("the {}th autoderef failed: {}",
48594849
i,
4860-
ty_to_string(cx, adjusted_ty))
4850+
adjusted_ty.user_string(cx))
48614851
);
48624852
}
48634853
}
@@ -5102,10 +5092,8 @@ pub fn impl_or_trait_item_idx(id: ast::Name, trait_items: &[ImplOrTraitItem])
51025092
pub fn ty_sort_string<'tcx>(cx: &ctxt<'tcx>, ty: Ty<'tcx>) -> String {
51035093
match ty.sty {
51045094
TyBool | TyChar | TyInt(_) |
5105-
TyUint(_) | TyFloat(_) | TyStr => {
5106-
::util::ppaux::ty_to_string(cx, ty)
5107-
}
5108-
TyTuple(ref tys) if tys.is_empty() => ::util::ppaux::ty_to_string(cx, ty),
5095+
TyUint(_) | TyFloat(_) | TyStr => ty.user_string(cx),
5096+
TyTuple(ref tys) if tys.is_empty() => ty.user_string(cx),
51095097

51105098
TyEnum(id, _) => format!("enum `{}`", item_path_str(cx, id)),
51115099
TyBox(_) => "box".to_string(),

0 commit comments

Comments
 (0)