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

Clarify Into description #1163

Closed
wants to merge 2 commits into from

Conversation

crajcan
Copy link
Contributor

@crajcan crajcan commented Mar 6, 2019

@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. 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.

@marioidival
Copy link
Member

@crajcan Oops, I'm sorry for the long delay.

I thought your change was good but to complement what we already had.

You can take your paragraph and replace it only with the first paragraph of the code snippet, keeping the second paragraph?

@crajcan
Copy link
Contributor Author

crajcan commented Aug 18, 2019

@crajcan Oops, I'm sorry for the long delay.

I thought your change was good but to complement what we already had.

You can take your paragraph and replace it only with the first paragraph of the code snippet, keeping the second paragraph?

@marioidival, thanks for taking the time to review.

Now that I look at this closer, it is apparent you are right about keeping the second paragraph. I have made another commit for you to review.

There is another sentence at the top of this page that I think has mislead some users (see issue #1149):

If you are able to convert type A from type B, then it
should be easy to believe that we should be able to convert type B to type A.

And perhaps a sentence in the API documentation that has done the same:

https://github.com/rust-lang/rust/blob/d19a359444295bab01de7ff44a9d72302e573bc9/src/libcore/convert.rs#L203

Since both from and into have the same type signatures, I think what is important to highlight in Rust By Example is that:

  1. The From implementation should be preferred
  2. Into is implemented on the destination type, while From is implemented on the origin type.
  3. Into must be implemented instead of From when both types are not defined by the current crate.

Perhaps these differences are be too subtle to warrant description in RBE. I'll try to make another small PR or two, and maybe you can review?

@marioidival
Copy link
Member

@crajcan of course!

@marioidival
Copy link
Member

@crajcan you can make it on this PR

@marioidival
Copy link
Member

@crajcan ?

@marioidival
Copy link
Member

@crajcan i can close this PR?

@crajcan crajcan closed this Feb 12, 2021
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.

4 participants