mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 16:24:46 +00:00
Auto merge of #116069 - compiler-errors:debug-tuple, r=Nilstrieb
Fix debug printing of tuple Self-explanatory. Didn't create a UI test, but I guess I could -- not sure where debug output shows up in rustc_attrs to make a sufficient test, tho.
This commit is contained in:
commit
26eeea6a1b
@ -531,22 +531,18 @@ impl<I: Interner> DebugWithInfcx<I> for TyKind<I> {
|
||||
}
|
||||
Never => write!(f, "!"),
|
||||
Tuple(t) => {
|
||||
let mut iter = t.clone().into_iter();
|
||||
|
||||
write!(f, "(")?;
|
||||
|
||||
match iter.next() {
|
||||
None => return write!(f, ")"),
|
||||
Some(ty) => write!(f, "{:?}", &this.wrap(ty))?,
|
||||
};
|
||||
|
||||
match iter.next() {
|
||||
None => return write!(f, ",)"),
|
||||
Some(ty) => write!(f, "{:?})", &this.wrap(ty))?,
|
||||
let mut count = 0;
|
||||
for ty in t.clone() {
|
||||
if count > 0 {
|
||||
write!(f, ", ")?;
|
||||
}
|
||||
write!(f, "{:?}", &this.wrap(ty))?;
|
||||
count += 1;
|
||||
}
|
||||
|
||||
for ty in iter {
|
||||
write!(f, ", {:?}", &this.wrap(ty))?;
|
||||
// unary tuples need a trailing comma
|
||||
if count == 1 {
|
||||
write!(f, ",")?;
|
||||
}
|
||||
write!(f, ")")
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user