Skip to content

Commit af61495

Browse files
committed
---
yaml --- r: 228273 b: refs/heads/try c: b0ab164 h: refs/heads/master i: 228271: b62e8a0 v: v3
1 parent e4a7049 commit af61495

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,7 +1,7 @@
11
---
22
refs/heads/master: aca2057ed5fb7af3f8905b2bc01f72fa001c35c8
33
refs/heads/snap-stage3: 1af31d4974e33027a68126fa5a5a3c2c6491824f
4-
refs/heads/try: 0bcbd169310556cfdc7b673df7992ba660ac4d3a
4+
refs/heads/try: b0ab164b80f8d559cfc96e1d1d3819993672cced
55
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
66
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
77
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try/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/try/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/try/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)