-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Add tests for collections to work with ZSTs #30982
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
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @brson (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. |
Thanks! Could you also add one for |
|
395cdff
to
845a65f
Compare
Ah ok, sounds good to me, thanks! @bors: r+ 845a65f56033e8aadd21fcf8c6d0d144c54ea8d9 |
|
tester.clear(); | ||
} | ||
} | ||
} |
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.
Strings store bytes, there's no ZST stuff to test...?
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.
Regardless the test is incorrect, the length of the string should never increase.
845a65f
to
0433967
Compare
Hopefully I've addressed the comments with the latest commit. |
@bors r+ Thanks for the quick response! |
📌 Commit 0433967 has been approved by |
0433967
to
cab559f
Compare
Travis CI was failing the previous commit; I've just updated it again. |
eff436f
to
42d7b9d
Compare
Did this actually get merged, or do we still need to r+ this? |
@bors: r=Gankro 42d7b9dbd7b4fa667be813a426a15175eb7447e8 |
⌛ Testing commit 42d7b9d with merge cbeae86... |
} | ||
assert_eq!(tester.len(), if len == 0 { 0 } else { 1 }); | ||
assert_eq!(tester.iter().count(), if len == 0 { 0 } else { 1 }); | ||
tester.clear(); |
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.
Why do these assertions pass? The Zst
is made to not be equal to itself (by PartialOrd, PartialEq), so n insertions should make a map with n elements?
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.
Oh! I misread the test... that's weird.
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's not zst specific, here's a non-zst https://play.rust-lang.org/?gist=0b20ed7ae5c5fb666bc3&version=nightly
and zst: https://play.rust-lang.org/?gist=5e63c60d587015a4ef2f&version=nightly
And wonky behavior is totally permissible, because the key type implements Ord but does not really have a total order (it's a broken trait impl).
@KiChjang I think the btreemap test needs to be fixed. The whole broken ordering thing kind of comes from me, I mentioned it as a possibility, but I didn't think of that it breaks the The only way to have a total order over Zst is to have them all equal.
Edit: The btreemap test needs to be fixed. |
Okay, so this means instead of impl PartialOrd being Ordering::Less, it should be Ordering::Equal instead? |
Just deriving all comparisons should work. Remove the case loop, it's redundant (I think?) |
42d7b9d
to
8feb3a4
Compare
Done... but is there a way to verify the tests work locally before I commit? |
Yes. |
// option. This file may not be copied, modified, or distributed | ||
// except according to those terms. | ||
|
||
use std::string::String; |
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 file could be removed? There is no ZSTs here.
004b559
to
aca4e6a
Compare
Did it work locally? |
Yes, it did. |
Great, let's go again! @bors r+ |
📌 Commit aca4e6a has been approved by |
Fixes #28518.