Skip to content

Commit 633aefa

Browse files
committed
---
yaml --- r: 212270 b: refs/heads/master c: 83c73e3 h: refs/heads/master v: v3
1 parent 7fd65d5 commit 633aefa

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 79b0c89d509d673ee34097b5dcb0d609fea6619d
2+
refs/heads/master: 83c73e327a95513256fb70d069b1cccd94fa6080
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: ba0e1cd8147d452c356aacb29fb87568ca26f111
55
refs/heads/try: 1864973ae17213c5a58c4dd3f9af6d1b6c7d2e05

trunk/src/librustc/util/ppaux.rs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,11 @@ pub fn ty_to_string<'tcx>(cx: &ctxt<'tcx>, typ: &ty::TyS<'tcx>) -> String {
311311
let mut s = String::new();
312312
s.push_str("[closure");
313313
push_sig_to_string(cx, &mut s, '(', ')', &cty.sig);
314-
s.push_str(&format!(" id={:?}]", did));
314+
if cx.sess.verbose() {
315+
s.push_str(&format!(" id={:?}]", did));
316+
} else {
317+
s.push(']');
318+
}
315319
s
316320
}
317321

@@ -412,11 +416,18 @@ pub fn ty_to_string<'tcx>(cx: &ctxt<'tcx>, typ: &ty::TyS<'tcx>) -> String {
412416
closure_tys.get(did).map(|closure_type| {
413417
closure_to_string(cx, &closure_type.subst(cx, substs), did)
414418
}).unwrap_or_else(|| {
419+
let id_str = if cx.sess.verbose() {
420+
format!(" id={:?}", did)
421+
} else {
422+
"".to_owned()
423+
};
424+
425+
415426
if did.krate == ast::LOCAL_CRATE {
416427
let span = cx.map.span(did.node);
417-
format!("[closure {} id={:?}]", span.repr(cx), did)
428+
format!("[closure {}{}]", span.repr(cx), id_str)
418429
} else {
419-
format!("[closure id={:?}]", did)
430+
format!("[closure{}]", id_str)
420431
}
421432
})
422433
}

0 commit comments

Comments
 (0)