Uh oh!
There was an error while loading. Please reload this page.
Add another PartialEq example - #51760
Conversation
There was a problem hiding this comment.
Space between ## and How and it => PartialEq imo
There was a problem hiding this comment.
That's not the issue. ;)
rust-highfive
commented
Jun 24, 2018
The job Click to expand the log.I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
e27a8eb to
e69fa24Comparerust-highfive
commented
Jun 24, 2018
Your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem. Click to expand the log.I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
rust-highfive
commented
Jun 25, 2018
The job Click to expand the log.I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
e69fa24 to
59782beCompareGuillaumeGomez
commented
Jun 28, 2018
ping @steveklabnik |
stokhos
commented
Jul 6, 2018
Ping from triage! @steveklabnik @rust-lang/docs , we haven't heard from you for a while, will youh ave time to look into this PR? |
stokhos
commented
Jul 21, 2018
Ping from triage, @rust-lang/docs anyone would want to review this PR? |
GuillaumeGomez
commented
Jul 21, 2018
There was a problem hiding this comment.
Not sure i agree with using "pretty easy" here. It's a poor phrase to use in documentation. How about something like this:
The type you can compare with is controlled by
PartialEq's type parameter. For example, let's tweak our previous code a bit:
Then you can follow up below the example with something like:
By changing
impl PartialEq for Booktoimpl PartialEq<BookFormat> for Book, we've changed what type we can use on the right side of the==operator. This lets us use it in theassert!statements at the bottom.
It would also be cool if you added one more example, combining them to show off that the same type can == to different types. Maybe continue with:
You can even combine these implementations to compare against both
BookandBookFormat, like this:(code sample with both
PartialEqimpls and both sets of assertions)
59782be to
b3f1f65CompareGuillaumeGomez
commented
Jul 22, 2018
Took your sentences and added the new code! (which was a good idea!) |
There was a problem hiding this comment.
I'm not a fan of "of course" either. How about:
You can also combine these implementations to let the
==operator work with two different types:
b3f1f65 to
f92b2bbCompareGuillaumeGomez
commented
Jul 23, 2018
Updated. |
steveklabnik
left a comment
There was a problem hiding this comment.
Sorry for missing the first ping :(
There was a problem hiding this comment.
This reads as awkward to me; can we get one last tweak?
/// ## How can I compare two different types?
There was a problem hiding this comment.
is this how rustfmt formats this code?
There was a problem hiding this comment.
I took the code above as is so I don't know?
There was a problem hiding this comment.
does this code need the &s? I'd expect them to not these days.
There was a problem hiding this comment.
It makes the code more clear.
There was a problem hiding this comment.
the `s should be around the whole "impl PartialEq for book" here
TimNN
commented
Aug 7, 2018
Ping from triage @GuillaumeGomez: Some changes have been requested to your PR. |
GuillaumeGomez
commented
Aug 8, 2018
Oh right! I'll update soon. |
f92b2bb to
663d6cdCompareGuillaumeGomez
commented
Aug 11, 2018
Updated to @steveklabnik's comments. |
XAMPPRocky
commented
Aug 21, 2018
Triage: @steveklabnik This PR requires your review. |
GuillaumeGomez
commented
Aug 21, 2018
Seems like I failed my rebase. I'll fix the conflicts. |
663d6cd to
3995bffCompareGuillaumeGomez
commented
Aug 21, 2018
Updated. |
emilyalbini
commented
Aug 27, 2018
Ping from triage! This PR needs a review, can @steveklabnik or someone else from @rust-lang/docs review this? |
QuietMisdreavus
commented
Aug 27, 2018
Looks good to me! Let's get this merged. @bors r+ rollup |
bors
commented
Aug 27, 2018
📌 Commit 3995bff has been approved by |
…q-example, r=QuietMisdreavus Add another PartialEq example r? @steveklabnik
…q-example, r=QuietMisdreavus Add another PartialEq example r? @steveklabnik
…q-example, r=QuietMisdreavus Add another PartialEq example r? @steveklabnik
…q-example, r=QuietMisdreavus Add another PartialEq example r? @steveklabnik
These examples to not follow the rules the documentation states for Cc @gnzlbg |
…q-example, r=QuietMisdreavus Add another PartialEq example r? @steveklabnik
Rollup of 20 pull requests Successful merges: - #51760 (Add another PartialEq example) - #53113 (Add example for Cow) - #53129 (remove `let x = baz` which was obscuring the real error) - #53389 (document effect of join on memory ordering) - #53472 (Use FxHash{Map,Set} instead of the default Hash{Map,Set} everywhere in rustc.) - #53476 (Add partialeq implementation for TryFromIntError type) - #53513 (Force-inline `shallow_resolve` at its hottest call site.) - #53655 (set applicability) - #53702 (Fix stabilisation version for macro_vis_matcher.) - #53727 (Do not suggest dereferencing in macro) - #53732 (save-analysis: Differentiate foreign functions and statics.) - #53740 (add llvm-readobj to llvm-tools-preview) - #53743 (fix a typo: taget_env -> target_env) - #53747 (Rustdoc fixes) - #53753 (expand keep-stage --help text) - #53756 (Fix typo in comment) - #53768 (move file-extension based .gitignore down to src/) - #53785 (Fix a comment in src/libcore/slice/mod.rs) - #53786 (Replace usages of 'bad_style' with 'nonstandard_style'.) - #53806 (Fix UI issues on Implementations on Foreign types) Failed merges: r? @ghost
r? @steveklabnik