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 documentation labelling and definitions for std::collections #129866

Merged
merged 1 commit into from
Sep 11, 2024

Conversation

root-goblin
Copy link
Contributor

Page affected: https://doc.rust-lang.org/std/collections/index.html#performance

Changes:

  • bulleted conventions
  • expanded definitions on terms used
  • more accessible language
  • more informative headings

@rustbot
Copy link
Collaborator

rustbot commented Sep 1, 2024

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @workingjubilee (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 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 Sep 1, 2024
Comment on lines 92 to 93
//! ### Amortized Costs
//!
Copy link
Member

Choose a reason for hiding this comment

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

This is not a subsection of the preceding section. These are not statements about conventions, these are factual statements about the collections. The introduction of sectioning here does not seem to add anything to this part of the documentation.

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 added subsections here originally to act as 'definition' headers, but reducing header noise is also pretty reasonable

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, I did see what you were trying to do! It just didn't seem to pan out quite like you intended, imo.

@rust-log-analyzer

This comment has been minimized.

Comment on lines 86 to 89
//! * The collection's size is denoted by `n`.
//! * If a second collection is involved, it's size is denoted by `m`.
//! * Item indices are denoted by `i`.
//! * Operations which have an *amortized* cost are suffixed with a `*`.
//! * Operations with an *expected* cost are suffixed with a `~`.
Copy link
Member

Choose a reason for hiding this comment

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

This part of the change seems fine, so I think the conventions should just be given the list without making them into a distinct subsection.

@workingjubilee
Copy link
Member

The bots want you to fix the trailing whitespace, it seems.

@workingjubilee
Copy link
Member

workingjubilee commented Sep 1, 2024

It seems you used the web interface to create this patch, which is... not the most amenable to following up on review comments, though if you want to continue working from there, that's fine by me (though you probably will have trouble if you wind up needing to rebase anything...). Let me know if you help with anything like using git on a local or running the tidy check or whatnot.

@rust-log-analyzer

This comment has been minimized.

@root-goblin
Copy link
Contributor Author

It seems you used the web interface to create this patch, which is... not the most amenable to following up on review comments, though if you want to continue working from there, that's fine by me (though you probably will have trouble if you wind up needing to rebase anything...).

I realised this too late as I do probably need to do some sort of a squash, I somehow imagined the web interface to be more capable than it actually is.

I could reopen a new PR that is better formatted if a cleaner commit is preferred.

@workingjubilee
Copy link
Member

workingjubilee commented Sep 2, 2024

Ah, no need to open a new PR.

I think the GitHub Codespaces interface is slightly more capable, although I've never used it for this repo so don't trust anything I say there.

In practice when I've used the web interface to create a patch and then am asked to iterate on it, what I usually have done is "just" clone the repo, add my fork as a remote, and then checkout the branch GitHub automatically created for me, and then I can just pull/push or whatever as I like.

If you wind up having difficulty doing that I'm happy to do it for you once we're done with review, as long as you're okay with me making decisions about how to reorganize the info in your commits~

@root-goblin
Copy link
Contributor Author

Okay I think it's ready for a review, I now understand tidy is catching the whitespace my editor was sneaking in.

Okay with me making decisions about how to reorganize the info in your commits~

For sure.

@root-goblin
Copy link
Contributor Author

@rustbot review

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.

Found some typos and interesting word choices.

library/std/src/collections/mod.rs Outdated Show resolved Hide resolved
library/std/src/collections/mod.rs Outdated Show resolved Hide resolved
library/std/src/collections/mod.rs Outdated Show resolved Hide resolved
library/std/src/collections/mod.rs Outdated Show resolved Hide resolved
library/std/src/collections/mod.rs Outdated Show resolved Hide resolved
library/std/src/collections/mod.rs Outdated Show resolved Hide resolved
library/std/src/collections/mod.rs Outdated Show resolved Hide resolved
@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 Sep 5, 2024
@root-goblin
Copy link
Contributor Author

@rustbot review

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

Cool, this looks good! Want to rebase this before I send it in?

@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 Sep 10, 2024
@rustbot
Copy link
Collaborator

rustbot commented Sep 10, 2024

There are merge commits (commits with multiple parents) in your changes. We have a no merge policy so these commits will need to be removed for this pull request to be merged.

You can start a rebase with the following commands:

$ # rebase
$ git pull --rebase https://github.com/rust-lang/rust.git master
$ git push --force-with-lease

The following commits are merge commits:

@workingjubilee
Copy link
Member

Hm!

@root-goblin
Copy link
Contributor Author

root-goblin commented Sep 10, 2024

I have pressed quite a spicy button, I think it's probably best to kill this one and reopen against master with just the changes.

Edit: I can reopen if there's some way of salvaging, but my side's history is going to be somewhat tricky to untangle - I'm not going to put that mess onto anyone else to figure out.

Page affected: https://doc.rust-lang.org/std/collections/index.html#performance

Changes:

- bulleted conventions
- expanded definitions on terms used
- more accessible language
- merged Sequence and Map performance cost tables
@rustbot rustbot removed 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 Sep 10, 2024
@workingjubilee
Copy link
Member

@root-goblin This is the sequence of commands I used to take the merge commit, undo it, reset the repository state, and then rebase and push to your branch. It has been edited somewhat to remove a few back-and-forth steps, as those would have been misleading.

git remote add rootgoblin git@github.com:root-goblin/rust.git
git fetch rootgoblin patch-1
git checkout rootgoblin/patch-1
git reset HEAD~1
git reset --hard
git status
rm -fr tests/ui
git reset --hard
git status
rm -fr compiler
rm -fr src
rm -fr tests
git reset --hard
git status
rm -fr library/std/src/os/rtems
rm -fr library/std/src/sys
git reset --hard
git log
git rebase -i HEAD~5
git status
git show
git switch -c patch-1
git push --set-upstream rootgoblin patch-1 --force

@workingjubilee
Copy link
Member

It actually only took me a couple minutes, I just didn't notice you asked for help until now because it was closed. 😅

@root-goblin
Copy link
Contributor Author

root-goblin commented Sep 10, 2024

@root-goblin This is the sequence of commands ...

Thanks for sorting it out! I'm definitely not familiar enough with this repo's commit conventions to boldly reset --hard

@workingjubilee
Copy link
Member

git reset --hard per se can only bring the repository's actual files visible to you closer to the state described by the current commit. So assuming you don't want to preserve any current additional work, it is safe. And the original git reset HEAD~1 was just popping off the merge commit.

@workingjubilee
Copy link
Member

...also, while I left in a couple of instances of git status and git show, there were about five times as many in the actual history, partly because I am the sort of person that runs ls, thinks about what just was printed to the screen, and then runs ls again, to see if anything changed in the 0 commands between. 😅

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.

Nice.

@workingjubilee
Copy link
Member

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Sep 10, 2024

📌 Commit 4198594 has been approved by workingjubilee

It is now in the queue for this repository.

@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 Sep 10, 2024
@root-goblin
Copy link
Contributor Author

git reset --hard per se can only bring the repository's actual files visible to you closer to the state described by the current commit. So assuming you don't want to preserve any current additional work, it is safe. And the original git reset HEAD~1 was just popping off the merge commit.

I have not thought of it that way before, but yeah that makes sense.

Thanks for helping out with the PR!

workingjubilee added a commit to workingjubilee/rustc that referenced this pull request Sep 11, 2024
Clarify documentation labelling and definitions for std::collections

Page affected: https://doc.rust-lang.org/std/collections/index.html#performance

Changes:
- bulleted conventions
- expanded definitions on terms used
- more accessible language
- more informative headings
bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 11, 2024
…kingjubilee

Rollup of 14 pull requests

Successful merges:

 - rust-lang#129260 (Don't suggest adding return type for closures with default return type)
 - rust-lang#129520 (Suggest the correct pattern syntax on usage of unit variant pattern for a struct variant)
 - rust-lang#129696 (update stdarch)
 - rust-lang#129759 (Stabilize `const_refs_to_static`)
 - rust-lang#129835 (enable const-float-classify test, and test_next_up/down on 32bit x86)
 - rust-lang#129866 (Clarify documentation labelling and definitions for std::collections)
 - rust-lang#130052 (Don't leave debug locations for constants sitting on the builder indefinitely)
 - rust-lang#130077 (Fix linking error when compiling for 32-bit watchOS)
 - rust-lang#130123 (Report the `note` when specified in `diagnostic::on_unimplemented`)
 - rust-lang#130156 (Add test for S_OBJNAME & update test for LF_BUILDINFO cl and cmd)
 - rust-lang#130206 (Map `WSAEDQUOT` to `ErrorKind::FilesystemQuotaExceeded`)
 - rust-lang#130207 (Map `ERROR_CANT_RESOLVE_FILENAME` to `ErrorKind::FilesystemLoop`)
 - rust-lang#130219 (Fix false positive with `missing_docs` and `#[test]`)
 - rust-lang#130221 (Make SearchPath::new public)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 11, 2024
…iaskrgr

Rollup of 9 pull requests

Successful merges:

 - rust-lang#129260 (Don't suggest adding return type for closures with default return type)
 - rust-lang#129520 (Suggest the correct pattern syntax on usage of unit variant pattern for a struct variant)
 - rust-lang#129866 (Clarify documentation labelling and definitions for std::collections)
 - rust-lang#130123 (Report the `note` when specified in `diagnostic::on_unimplemented`)
 - rust-lang#130161 (refactor merge base logic and fix `x fmt`)
 - rust-lang#130206 (Map `WSAEDQUOT` to `ErrorKind::FilesystemQuotaExceeded`)
 - rust-lang#130207 (Map `ERROR_CANT_RESOLVE_FILENAME` to `ErrorKind::FilesystemLoop`)
 - rust-lang#130219 (Fix false positive with `missing_docs` and `#[test]`)
 - rust-lang#130221 (Make SearchPath::new public)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 6d7ccad into rust-lang:master Sep 11, 2024
6 checks passed
@rustbot rustbot added this to the 1.83.0 milestone Sep 11, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Sep 11, 2024
Rollup merge of rust-lang#129866 - root-goblin:patch-1, r=workingjubilee

Clarify documentation labelling and definitions for std::collections

Page affected: https://doc.rust-lang.org/std/collections/index.html#performance

Changes:
- bulleted conventions
- expanded definitions on terms used
- more accessible language
- more informative headings
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants