Skip to content

Commit 644e5cf

Browse files
committed
---
yaml --- r: 220031 b: refs/heads/snap-stage3 c: b0ab164 h: refs/heads/master i: 220029: fda71e6 220027: 8de3460 220023: ce20ed0 220015: 7e193dc 219999: 0763510 219967: 9b1d758 219903: 03ee398 v: v3
1 parent 63790b8 commit 644e5cf

File tree

4 files changed

+18
-3
lines changed

4 files changed

+18
-3
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
refs/heads/master: c044791d80ea0dc5c4b57b6030a67b69f8510239
3-
refs/heads/snap-stage3: 0bcbd169310556cfdc7b673df7992ba660ac4d3a
3+
refs/heads/snap-stage3: b0ab164b80f8d559cfc96e1d1d3819993672cced
44
refs/heads/try: b53c0f93eedcdedd4fd89bccc5a3a09d1c5cd23e
55
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
66
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596

branches/snap-stage3/src/libcore/fmt/builders.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,12 @@ impl<'a, 'b: 'a> DebugTuple<'a, 'b> {
175175
fn is_pretty(&self) -> bool {
176176
self.fmt.flags() & (1 << (FlagV1::Alternate as usize)) != 0
177177
}
178+
179+
/// Returns the wrapped `Formatter`.
180+
#[unstable(feature = "debug_builder_formatter", reason = "recently added")]
181+
pub fn formatter(&mut self) -> &mut fmt::Formatter<'b> {
182+
&mut self.fmt
183+
}
178184
}
179185

180186
struct DebugInner<'a, 'b: 'a> {

branches/snap-stage3/src/libcore/fmt/mod.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1490,7 +1490,16 @@ macro_rules! tuple {
14901490
fn fmt(&self, f: &mut Formatter) -> Result {
14911491
let mut builder = f.debug_tuple("");
14921492
let ($(ref $name,)*) = *self;
1493-
$(builder.field($name);)*
1493+
let mut n = 0;
1494+
$(
1495+
builder.field($name);
1496+
n += 1;
1497+
)*
1498+
1499+
if n == 1 {
1500+
try!(write!(builder.formatter(), ","));
1501+
}
1502+
14941503
builder.finish()
14951504
}
14961505
}

branches/snap-stage3/src/libcoretest/tuple.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ fn test_tuple_cmp() {
6060
#[test]
6161
fn test_show() {
6262
let s = format!("{:?}", (1,));
63-
assert_eq!(s, "(1)");
63+
assert_eq!(s, "(1,)");
6464
let s = format!("{:?}", (1, true));
6565
assert_eq!(s, "(1, true)");
6666
let s = format!("{:?}", (1, "hi", true));

0 commit comments

Comments
 (0)