Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix debug infinite loop #41342

Merged
merged 1 commit into from
Apr 21, 2017
Merged

Conversation

GuillaumeGomez
Copy link
Member

Fixes #41338.

@rust-highfive
Copy link
Collaborator

r? @BurntSushi

(rust_highfive has picked a reviewer for you, use r? to override)

@sfackler
Copy link
Member

How is this going to fix things? Isn't it just going to recurse the same way?

@GuillaumeGomez
Copy link
Member Author

You give me a doubt on the fact that I tested correctly.

@GuillaumeGomez GuillaumeGomez changed the title Fix debug infinite loop [WIP] Fix debug infinite loop Apr 17, 2017
@GuillaumeGomez GuillaumeGomez changed the title [WIP] Fix debug infinite loop Fix debug infinite loop Apr 17, 2017
@GuillaumeGomez
Copy link
Member Author

Fixed for good this time.

Copy link
Member

@ollie27 ollie27 left a 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

f.debug_tuple("Difference")
.field(&self.clone())
.finish()
write!(f, "Difference({:?}, {:?})", self.a, self.b)
Copy link
Member

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.

Copy link
Member Author

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.

@BurntSushi BurntSushi assigned sfackler and unassigned BurntSushi Apr 19, 2017
@aidanhs aidanhs added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Apr 19, 2017
@GuillaumeGomez
Copy link
Member Author

Updated.

@alexcrichton
Copy link
Member

@bors: r+

@bors
Copy link
Contributor

bors commented Apr 20, 2017

📌 Commit a850cdc has been approved by alexcrichton

@bors
Copy link
Contributor

bors commented Apr 20, 2017

⌛ Testing commit a850cdc with merge 4eb85e2...

@bors
Copy link
Contributor

bors commented Apr 20, 2017

💔 Test failed - status-appveyor

@alexcrichton
Copy link
Member

@bors
Copy link
Contributor

bors commented Apr 20, 2017

⌛ Testing commit a850cdc with merge 535ee6c...

bors added a commit that referenced this pull request Apr 20, 2017
@bors
Copy link
Contributor

bors commented Apr 21, 2017

☀️ Test successful - status-appveyor, status-travis
Approved by: alexcrichton
Pushing 535ee6c to master...

@bors bors merged commit a850cdc into rust-lang:master Apr 21, 2017
@GuillaumeGomez GuillaumeGomez deleted the btree-debug-infinite branch April 22, 2017 22:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants