Skip to content

Add documentation for PathBuf's FromIterator and Extend impls #142236

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

Merged
merged 1 commit into from
Jun 16, 2025

Conversation

yotamofek
Copy link
Contributor

I think it's not very obvious that PathBuf's Extend and FromIterator impls work like PathBuf::push, so I think these should be documented.
I'm not very happy with the wording and examples, open to suggestions :)

@rustbot
Copy link
Collaborator

rustbot commented Jun 9, 2025

r? @joboet

rustbot has assigned @joboet.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@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 Jun 9, 2025
Copy link
Contributor

@tgross35 tgross35 left a comment

Choose a reason for hiding this comment

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

Two nits and please squash, then lgtm

@yotamofek yotamofek force-pushed the pr/std/pathbuf-extend-docs branch from aed8aff to a0240fa Compare June 16, 2025 07:45
@@ -1891,6 +1904,19 @@ impl<P: AsRef<Path>> FromIterator<P> for PathBuf {

#[stable(feature = "rust1", since = "1.0.0")]
impl<P: AsRef<Path>> Extend<P> for PathBuf {
/// Extends `self` with [`Path`] elements from `iter`.
///
/// This uses [`push`](Self::push) to add each element, so can be used to adjoin multiple path [components](Components).
Copy link
Contributor

Choose a reason for hiding this comment

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

One more line wrap please :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops 😅

@yotamofek yotamofek force-pushed the pr/std/pathbuf-extend-docs branch from a0240fa to 45bbb3d Compare June 16, 2025 07:49
Copy link
Contributor

@tgross35 tgross35 left a comment

Choose a reason for hiding this comment

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

Thanks!

@tgross35
Copy link
Contributor

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Jun 16, 2025

📌 Commit 45bbb3d has been approved by tgross35

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 Jun 16, 2025
@tgross35 tgross35 assigned tgross35 and unassigned joboet Jun 16, 2025
bors added a commit that referenced this pull request Jun 16, 2025
Rollup of 12 pull requests

Successful merges:

 - #141639 (Expose discriminant values in stable_mir)
 - #142082 (Refactor `rustc_attr_data_structures` documentation)
 - #142125 (Stabilize "file_lock" feature)
 - #142236 (Add documentation for `PathBuf`'s `FromIterator` and `Extend` impls)
 - #142373 (Fix Debug for Location)
 - #142416 (Assorted bootstrap cleanups (step 2))
 - #142431 (Add initial version of snapshot tests to bootstrap)
 - #142450 (Add documentation on top of `rustc_middle/src/query/mod.rs`)
 - #142528 (clarify `rustc_do_not_const_check` comment)
 - #142530 (use `if let` guards where possible)
 - #142561 (Remove an `njn:` comment accidentaly left behind.)
 - #142566 (Fix `-nopt` CI jobs)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 6092c1a into rust-lang:master Jun 16, 2025
10 checks passed
@rustbot rustbot added this to the 1.89.0 milestone Jun 16, 2025
rust-timer added a commit that referenced this pull request Jun 16, 2025
Rollup merge of #142236 - yotamofek:pr/std/pathbuf-extend-docs, r=tgross35

Add documentation for `PathBuf`'s `FromIterator` and `Extend` impls

I think it's not very obvious that `PathBuf`'s `Extend` and `FromIterator` impls work like `PathBuf::push`, so I think these should be documented.
I'm not very happy with the wording and examples, open to suggestions :)
compiler-errors pushed a commit to compiler-errors/rust that referenced this pull request Jun 16, 2025
Rollup of 12 pull requests

Successful merges:

 - rust-lang#141639 (Expose discriminant values in stable_mir)
 - rust-lang#142082 (Refactor `rustc_attr_data_structures` documentation)
 - rust-lang#142125 (Stabilize "file_lock" feature)
 - rust-lang#142236 (Add documentation for `PathBuf`'s `FromIterator` and `Extend` impls)
 - rust-lang#142373 (Fix Debug for Location)
 - rust-lang#142416 (Assorted bootstrap cleanups (step 2))
 - rust-lang#142431 (Add initial version of snapshot tests to bootstrap)
 - rust-lang#142450 (Add documentation on top of `rustc_middle/src/query/mod.rs`)
 - rust-lang#142528 (clarify `rustc_do_not_const_check` comment)
 - rust-lang#142530 (use `if let` guards where possible)
 - rust-lang#142561 (Remove an `njn:` comment accidentaly left behind.)
 - rust-lang#142566 (Fix `-nopt` CI jobs)

r? `@ghost`
`@rustbot` modify labels: rollup
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Jun 17, 2025
Rollup of 12 pull requests

Successful merges:

 - rust-lang/rust#141639 (Expose discriminant values in stable_mir)
 - rust-lang/rust#142082 (Refactor `rustc_attr_data_structures` documentation)
 - rust-lang/rust#142125 (Stabilize "file_lock" feature)
 - rust-lang/rust#142236 (Add documentation for `PathBuf`'s `FromIterator` and `Extend` impls)
 - rust-lang/rust#142373 (Fix Debug for Location)
 - rust-lang/rust#142416 (Assorted bootstrap cleanups (step 2))
 - rust-lang/rust#142431 (Add initial version of snapshot tests to bootstrap)
 - rust-lang/rust#142450 (Add documentation on top of `rustc_middle/src/query/mod.rs`)
 - rust-lang/rust#142528 (clarify `rustc_do_not_const_check` comment)
 - rust-lang/rust#142530 (use `if let` guards where possible)
 - rust-lang/rust#142561 (Remove an `njn:` comment accidentaly left behind.)
 - rust-lang/rust#142566 (Fix `-nopt` CI jobs)

r? `@ghost`
`@rustbot` modify labels: rollup
lnicola pushed a commit to lnicola/rust-analyzer that referenced this pull request Jun 18, 2025
Rollup of 12 pull requests

Successful merges:

 - rust-lang/rust#141639 (Expose discriminant values in stable_mir)
 - rust-lang/rust#142082 (Refactor `rustc_attr_data_structures` documentation)
 - rust-lang/rust#142125 (Stabilize "file_lock" feature)
 - rust-lang/rust#142236 (Add documentation for `PathBuf`'s `FromIterator` and `Extend` impls)
 - rust-lang/rust#142373 (Fix Debug for Location)
 - rust-lang/rust#142416 (Assorted bootstrap cleanups (step 2))
 - rust-lang/rust#142431 (Add initial version of snapshot tests to bootstrap)
 - rust-lang/rust#142450 (Add documentation on top of `rustc_middle/src/query/mod.rs`)
 - rust-lang/rust#142528 (clarify `rustc_do_not_const_check` comment)
 - rust-lang/rust#142530 (use `if let` guards where possible)
 - rust-lang/rust#142561 (Remove an `njn:` comment accidentaly left behind.)
 - rust-lang/rust#142566 (Fix `-nopt` CI jobs)

r? `@ghost`
`@rustbot` modify labels: rollup
@yotamofek yotamofek deleted the pr/std/pathbuf-extend-docs branch June 18, 2025 08:53
github-actions bot pushed a commit to model-checking/verify-rust-std that referenced this pull request Jun 18, 2025
…cs, r=tgross35

Add documentation for `PathBuf`'s `FromIterator` and `Extend` impls

I think it's not very obvious that `PathBuf`'s `Extend` and `FromIterator` impls work like `PathBuf::push`, so I think these should be documented.
I'm not very happy with the wording and examples, open to suggestions :)
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