-
Notifications
You must be signed in to change notification settings - Fork 13.1k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Fix debug infinite loop #41342
Fix debug infinite loop #41342
Conversation
r? @BurntSushi (rust_highfive has picked a reviewer for you, use r? to override) |
How is this going to fix things? Isn't it just going to recurse the same way? |
You give me a doubt on the fact that I tested correctly. |
c437324
to
01e2f03
Compare
Fixed for good this time. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at #39002, the same mistake was made for the following types as well which need to be fixed:
enum_set::Iter
linked_list::Iter
linked_list::IterMut
linked_list::IntoIter
linked_list::FrontPlace
linked_list::BackPlace
vec_deque::Iter
vec_deque::IterMut
vec_deque::IntoIter
vec_deque::Drain
src/libcollections/btree/set.rs
Outdated
f.debug_tuple("Difference") | ||
.field(&self.clone()) | ||
.finish() | ||
write!(f, "Difference({:?}, {:?})", self.a, self.b) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be better to use f.debug_tuple("Difference").field(&self.a).field(&self.b).finish()
but in this case as it's including every field, #[derive(Debug)]
would suffice.
However, like other iterators in std
this could use f.debug_list().entries(self.clone()).finish()
to display a list of the items the iterator will return.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like a better idea. Updating and testing.
01e2f03
to
a850cdc
Compare
Updated. |
@bors: r+ |
📌 Commit a850cdc has been approved by |
⌛ Testing commit a850cdc with merge 4eb85e2... |
💔 Test failed - status-appveyor |
@bors: retry |
…chton Fix debug infinite loop Fixes #41338.
☀️ Test successful - status-appveyor, status-travis |
Fixes #41338.