Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Mention intent of From trait in its docs #92541

Merged
merged 1 commit into from
Mar 10, 2022

Conversation

asquared31415
Copy link
Contributor

This pr is a docs modification to add to the documentation of the From trait a note about its intent as a perfect conversion. This is already stated in the TryFrom docs so this is simply adding that information in a more visible way.

@rust-highfive
Copy link
Collaborator

r? @m-ou-se

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 3, 2022
@asquared31415
Copy link
Contributor Author

Excerpt from TryFrom for reference:

The From trait is intended for perfect conversions, so the TryFrom trait informs the programmer when a type conversion could go bad and lets them decide how to handle it.

From docs

@camelid
Copy link
Member

camelid commented Jan 4, 2022

It seems the wording is pre-existing, but I thought operations like this are usually referred to as "total", not "perfect"?

@camelid camelid added A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. labels Jan 4, 2022
@asquared31415
Copy link
Contributor Author

I've heard of "total" in the context of the mathematical terms for total ordering and such, but I have never heard it in this context (though not to say that's wrong). The point is that this is meant to be non-lossy and infallible, if there's better wording I could make this PR adjust/clarify that too, I simply used the existing wording.

@camelid
Copy link
Member

camelid commented Jan 4, 2022

Yeah, using the existing wording is probably fine. The use of "perfect" just caught my attention since I usually think of "total" as in total functional programming.

@JohnCSimon JohnCSimon added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 23, 2022
@JohnCSimon JohnCSimon added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 27, 2022
@m-ou-se
Copy link
Member

m-ou-se commented Mar 9, 2022

Thanks!

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Mar 9, 2022

📌 Commit 9054fbb has been approved by m-ou-se

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 9, 2022
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Mar 9, 2022
Mention intent of `From` trait in its docs

This pr is a docs modification to add to the documentation of the `From` trait a note about its intent as a perfect conversion.  This is already stated in the `TryFrom` docs so this is simply adding that information in a more visible way.
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Mar 9, 2022
Mention intent of `From` trait in its docs

This pr is a docs modification to add to the documentation of the `From` trait a note about its intent as a perfect conversion.  This is already stated in the `TryFrom` docs so this is simply adding that information in a more visible way.
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Mar 9, 2022
Mention intent of `From` trait in its docs

This pr is a docs modification to add to the documentation of the `From` trait a note about its intent as a perfect conversion.  This is already stated in the `TryFrom` docs so this is simply adding that information in a more visible way.
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 10, 2022
…askrgr

Rollup of 8 pull requests

Successful merges:

 - rust-lang#91804 (Make some `Clone` impls `const`)
 - rust-lang#92541 (Mention intent of `From` trait in its docs)
 - rust-lang#93057 (Add Iterator::collect_into)
 - rust-lang#94739 (Suggest `if let`/`let_else` for refutable pat in `let`)
 - rust-lang#94754 (Warn users about `||` in let chain expressions)
 - rust-lang#94763 (Add documentation about lifetimes to thread::scope.)
 - rust-lang#94768 (Ignore `close_read_wakes_up` test on SGX platform)
 - rust-lang#94772 (Add miri to the well known conditional compilation names and values)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 2567d0f into rust-lang:master Mar 10, 2022
@rustbot rustbot added this to the 1.61.0 milestone Mar 10, 2022
@asquared31415 asquared31415 deleted the from-docs branch September 3, 2022 00:29
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants