Skip to content

Conversation

letheed
Copy link
Contributor

@letheed letheed commented May 31, 2015

I tried to retain the information on the bounds in a few comments because it does matter.
Close #582

@rust-highfive
Copy link

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @steveklabnik (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. 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.

Copy link
Contributor

Choose a reason for hiding this comment

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

This isn't quite right. Add<RHS = Self> seems to force RHS to default to Self. So:

impl Add<f64> for T {} // T + f64 (override default)
impl Add for T // T + T (RHS is Self because of the default)

There is no defaults section though probably because I couldn't figure them out when I was working on the associated types sections.

Copy link
Contributor

Choose a reason for hiding this comment

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

Note: this isn't your mistake. It just wasn't written correctly before.

It's mainly an issue because it uses <X = Y> but the actual example doesn't require that part.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Apologies, I missed that comment yesterday... Well I didn't know about that defaulting mechanism indeed, it's nice.
I updated the comment to mention that. I would have removed that line but since it's not explained anywhere else, it does get confusing. Let me know if there's anything else.

@mdinger
Copy link
Contributor

mdinger commented May 31, 2015

This seems good other than that assuming @steveklabnik doesn't have issues with it.

@letheed
Copy link
Contributor Author

letheed commented Jun 1, 2015

I removed one of the blocks as you suggested. I didn't do it at first because I wasn't sure how much you wanted me to depart from the initial example. But you're right, keeping the two was probably not necessary.

@mdinger
Copy link
Contributor

mdinger commented Jun 1, 2015

Awesome. If the other nit is fixed this seems good to me.

@mdinger
Copy link
Contributor

mdinger commented Jun 1, 2015

Nice! Looks good to me. Now just wait for official review from @steveklabnik.

Copy link
Contributor

Choose a reason for hiding this comment

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

since you've added below, the period at the end here should be removed

@steveklabnik
Copy link
Contributor

Hey @letheed ! Thanks so much for this, and sorry it's taken me a while to review. I agree with @mdinger that this is much better, just some formatting nits. Thank you!

@mdinger
Copy link
Contributor

mdinger commented Jun 8, 2015

@steveklabnik you probably want to skim #582 where other options are discussed for changing this as well.

Note: I'm not currently inclined to make any of the changes suggested but someone else might take it and run with it.

@letheed
Copy link
Contributor Author

letheed commented Jun 8, 2015

No worries... You're welcome, and ty the website was very helpful ! 👍
Rust's official doc is rather exhaustive but can be a little intricate for beginners. Also examples help a lot.

I've tried to follow your instructions, although there's still one or two details I'm not sure about, mostly regarding periods.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I moved the period to the end of the sentence. I'm not sure if you wanted it removed completely, but I thought that would be inconsistent with line 13.

Copy link
Contributor

Choose a reason for hiding this comment

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

Overall, we may have inconsistencies. Rust by Example was donated to the Rust organization, and I haven't had the chance to go over the entire thing yet. So, when adding new stuff, I tend to apply our already-existing conventions, even though the project as a whole may not have totally adopted them yet. Make sense?

@mdinger
Copy link
Contributor

mdinger commented Jun 8, 2015

I'm glad the sites helpful. The site doesn't get many critiques anymore. They're all directed at the book

@steveklabnik
Copy link
Contributor

Ah! I didn't see that this was fixed. Thanks so much @letheed !

steveklabnik added a commit that referenced this pull request Jul 1, 2015
generics/phantom/testcase_units: alleviate the syntactical heaviness of the types and bounds
@steveklabnik steveklabnik merged commit da6c1ad into rust-lang:master Jul 1, 2015
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.

generics/phantom/testcase_units: example adds unnecessary complication

4 participants