Skip to content

Check tail node in check_links #46269

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

Merged
merged 1 commit into from
Nov 26, 2017
Merged

Check tail node in check_links #46269

merged 1 commit into from
Nov 26, 2017

Conversation

udoprog
Copy link
Contributor

@udoprog udoprog commented Nov 25, 2017

No description provided.

@rust-highfive
Copy link
Contributor

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @KodrAus (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@@ -1314,6 +1316,11 @@ mod tests {
}
}
}

// verify that the tail node points to the last node.
let tail = list.tail.as_ref().expect("some tail node").as_ref();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need the extra as_ref at the end here?

Copy link
Contributor Author

@udoprog udoprog Nov 26, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

list.tail is an Option<Shared<Node<T>>>. The first as_ref avoids creating a local copy (which would have to be in scope). The second converts the Shared ptr into a reference (through Shared::as_ref), which can then be casted.

So yes unless I'm missing something?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I see, sorry I hadn't noticed the extra level of indirection in there. Looks like the way you're doing this is about as good as it gets, since Shared::as_ptr returns a *mut T, so you'd have to cast that anyways.

@KodrAus
Copy link
Contributor

KodrAus commented Nov 26, 2017

Hi @udoprog, thanks for improving these tests! This looks good to me, just one tiny question about a maybe redundant as_ref.

@KodrAus
Copy link
Contributor

KodrAus commented Nov 26, 2017

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Nov 26, 2017

@KodrAus: 🔑 Insufficient privileges: and not in try users

@bors
Copy link
Collaborator

bors commented Nov 26, 2017

@KodrAus: 🔑 Insufficient privileges: Not in reviewers

@KodrAus
Copy link
Contributor

KodrAus commented Nov 26, 2017

Hmm @kennytm should I be able to r+ after your changes recently?

@kennytm
Copy link
Member

kennytm commented Nov 26, 2017

@bors r=KodrAus rollup

@KodrAus maybe ask on the IRC channel. The change still needs to be deployed to work.

@bors
Copy link
Collaborator

bors commented Nov 26, 2017

📌 Commit 4e4f8ab has been approved by KodrAus

@udoprog
Copy link
Contributor Author

udoprog commented Nov 26, 2017

Thank you!

kennytm added a commit to kennytm/rust that referenced this pull request Nov 26, 2017
bors added a commit that referenced this pull request Nov 26, 2017
Rollup of 7 pull requests

- Successful merges: #46201, #46224, #46234, #46252, #46259, #46264, #46269
- Failed merges:
@bors bors merged commit 4e4f8ab into rust-lang:master Nov 26, 2017
@udoprog udoprog deleted the check-links branch November 26, 2017 11:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants