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

Document From::from impls #137330

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open

Conversation

TimTheBig
Copy link

This resolves #51430 by documenting all from impls in lib std and core.
I still need someone to look over a few of the comments to see if the style is correct.

@rustbot
Copy link
Collaborator

rustbot commented Feb 20, 2025

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @Amanieu (or someone else) some time within the next two weeks.

Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (S-waiting-on-review and S-waiting-on-author) stays updated, invoking these commands when appropriate:

  • @rustbot author: the review is finished, PR author should check the comments and take action accordingly
  • @rustbot review: the author is ready for a review, this PR will be queued again in the reviewer's queue

@rustbot rustbot added O-linux Operating system: Linux O-solid Operating System: SOLID O-unix Operating system: Unix-like O-windows Operating system: Windows S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Feb 20, 2025
@rustbot
Copy link
Collaborator

rustbot commented Feb 20, 2025

The Miri subtree was changed

cc @rust-lang/miri

Portable SIMD is developed in its own repository. If possible, consider making this change to rust-lang/portable-simd instead.

cc @calebzulawski, @programmerjake

rust-analyzer is developed in its own repository. If possible, consider making this change to rust-lang/rust-analyzer instead.

cc @rust-lang/rust-analyzer

Some changes occurred in src/tools/clippy

cc @rust-lang/clippy

@fmease fmease changed the title Document from Document From::from impls Feb 20, 2025
@TimTheBig
Copy link
Author

@rustbot label A-docs C-enhancement T-libs-api

@rustbot rustbot added A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools C-enhancement Category: An issue proposing an enhancement or a PR with one. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. labels Feb 20, 2025
@TimTheBig
Copy link
Author

TimTheBig commented Feb 20, 2025

Should I move Portable SIMD and rust-analyzer changes even though they are small?

@rust-log-analyzer

This comment has been minimized.

@RalfJung
Copy link
Member

It is generally a good idea to split up large changes. :) You changed a whole bunch of files in rust-analyzer, so yeah that should be split. Miri and clippy have fewer changes, but the fact that there are any changes at all there still contradicts the PR description.

It's too late now, but the best strategy for PRs like this is to start with just a few files, e.g. just core, take the review feedback, and then apply that to the next PRs. That avoids having to re-do large amounts of work when there is overarching feedback.

@rustbot
Copy link
Collaborator

rustbot commented Feb 20, 2025

The Miri subtree was changed

cc @rust-lang/miri

Some changes occurred in src/tools/clippy

cc @rust-lang/clippy

Portable SIMD is developed in its own repository. If possible, consider making this change to rust-lang/portable-simd instead.

cc @calebzulawski, @programmerjake

rust-analyzer is developed in its own repository. If possible, consider making this change to rust-lang/rust-analyzer instead.

cc @rust-lang/rust-analyzer

@TimTheBig
Copy link
Author

TimTheBig commented Feb 20, 2025

My mistake, I will revert the rust-analyzer changes.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rustbot rustbot added has-merge-commits PR has merge commits, merge with caution. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Feb 20, 2025
@rustbot

This comment has been minimized.

Co-authored-by: Alejandra González <[email protected]>
@TimTheBig TimTheBig requested a review from oli-obk March 6, 2025 23:17
@oli-obk
Copy link
Contributor

oli-obk commented Mar 7, 2025

r? libs

There are to many impls I haven't made much review progress

@rustbot rustbot assigned workingjubilee and unassigned Amanieu Mar 7, 2025
Copy link
Member

@workingjubilee workingjubilee left a comment

Choose a reason for hiding this comment

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

I do not believe you have self-reviewed this adequately, and I do not agree with the direction of this PR. Please first remove all instances where the documentation is trivial... for example, for From<X> for Y, the documentation is most certainly trivial when it is "Wraps X in Y"... or for only internal-facing APIs.

Comment on lines +393 to +396
/// Converts a SIMD mask to an array of bools.
///
/// ## Cost
/// Copies the bytes of the array
Copy link
Member

@workingjubilee workingjubilee Mar 7, 2025

Choose a reason for hiding this comment

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

incorrect and furthermore misleading, as the real cost is the usage of instructions for converting the mask types to the boolean values, which can be extremely expensive relative to merely moving the bytes around. these may perform essentially arbitrary computation to extract the mask from the opaque representation into a sequence of bytes where each byte is exactly 0x00 or 0x01.

Copy link
Member

Choose a reason for hiding this comment

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

it's still relatively cheap, but merely moving bytes can easily be, well, the easy part, and for people who care about the cost of something done in SIMD, it can be one of the highest costs in their program!

@@ -109,6 +109,7 @@ pub trait Wake {
impl<W: Wake + Send + Sync + 'static> From<Arc<W>> for Waker {
/// Use a [`Wake`]-able type as a `Waker`.
///
/// ## Cost
Copy link
Member

Choose a reason for hiding this comment

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

I do not agree with this new "Cost" heading

Copy link
Author

Choose a reason for hiding this comment

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

Why so, I think it makes it more clear.

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 7, 2025
Copy link
Member

@workingjubilee workingjubilee left a comment

Choose a reason for hiding this comment

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

It's too late now,

I do not think it is too late. Factoring this PR to make it reviewable is now a blocking consideration for this PR now that it is in my queue. I'm sorry you had to wait to hear that, @TimTheBig, but this PR has to be reviewed fairly carefully to make sure that it does not present anything that could be misinterpreted as new stable guarantees about how these APIs work, unless they are trivially obvious to guarantee. In many cases these are actually not as obvious to me, so I am going to insist that this is well-organized, at minimum.

The entire library API surface change of this should be separated from anything that documents only internal-facing APIs or only affects things in src/tools

@TimTheBig
Copy link
Author

@programmerjake, @oli-obk, @blyxyas, @workingjubilee, thanks for all the help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools C-enhancement Category: An issue proposing an enhancement or a PR with one. O-linux Operating system: Linux O-solid Operating System: SOLID O-unix Operating system: Unix-like O-windows Operating system: Windows S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-libs Relevant to the library team, which will review and decide on the PR/issue. 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.

Many From implementations are undocumented
9 participants