std: use a TAIT to define SplitPaths on UNIX#145242
Conversation
|
rustbot has assigned @Mark-Simulacrum. Use |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
|
Note that this does not concern the public |
library/std/src/sys/pal/unix/os.rs
Outdated
| pub struct SplitPaths<'a> { | ||
| iter: iter::Map<slice::Split<'a, u8, fn(&u8) -> bool>, fn(&'a [u8]) -> PathBuf>, | ||
| } | ||
| pub type SplitPaths<'a> = impl Iterator<Item = PathBuf> + 'a; |
There was a problem hiding this comment.
Should these items be pub(crate) if so?
We'd rather not be exposing a TAIT to downstream code, I imagine, so it might be better to enforce that with proper visibility:
| pub type SplitPaths<'a> = impl Iterator<Item = PathBuf> + 'a; | |
| pub(crate) type SplitPaths<'a> = impl Iterator<Item = PathBuf> + 'a; |
There was a problem hiding this comment.
None of the items in sys is exposed publicly, but we still use pub instead of pub(crate) almost everywhere. I don't really want to break the pattern and cause unnecessary confusion.
3a4164f to
cb388c6
Compare
|
☔ The latest upstream changes (presumably #145489) made this pull request unmergeable. Please resolve the merge conflicts. |
|
r=me |
cb388c6 to
85cefab
Compare
|
This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
std: use a TAIT to define `SplitPaths` on UNIX Defining `SplitPaths` as a TAIT allows using closures instead of function pointers for `split` and `map`.
|
💔 Test failed - checks-actions |
|
That's definitely spurious. |
|
💡 This pull request was already approved, no need to approve it again.
|
|
A job failed! Check out the build log: (web) (plain enhanced) (plain) Click to see the possible cause of the failure (guessed by this bot) |
…mulacrum std: use a TAIT to define `SplitPaths` on UNIX Defining `SplitPaths` as a TAIT allows using closures instead of function pointers for `split` and `map`.
…mulacrum std: use a TAIT to define `SplitPaths` on UNIX Defining `SplitPaths` as a TAIT allows using closures instead of function pointers for `split` and `map`.
…mulacrum std: use a TAIT to define `SplitPaths` on UNIX Defining `SplitPaths` as a TAIT allows using closures instead of function pointers for `split` and `map`.
Rollup of 6 pull requests Successful merges: - #144964 (std: clarify `OpenOptions` error for create without write access) - #145242 (std: use a TAIT to define `SplitPaths` on UNIX) - #145467 (Stabilize `strict_provenance_atomic_ptr` feature) - #145990 (`AutoDeref::final_ty` is already resolved) - #145991 (std: haiku: fix `B_FIND_PATH_IMAGE_PATH`) - #146000 (Improve librustdoc error when a file creation/modification failed) r? `@ghost` `@rustbot` modify labels: rollup
…mulacrum std: use a TAIT to define `SplitPaths` on UNIX Defining `SplitPaths` as a TAIT allows using closures instead of function pointers for `split` and `map`.
…mulacrum std: use a TAIT to define `SplitPaths` on UNIX Defining `SplitPaths` as a TAIT allows using closures instead of function pointers for `split` and `map`.
…mulacrum std: use a TAIT to define `SplitPaths` on UNIX Defining `SplitPaths` as a TAIT allows using closures instead of function pointers for `split` and `map`.
Rollup of 9 pull requests Successful merges: - #145242 (std: use a TAIT to define `SplitPaths` on UNIX) - #145467 (Stabilize `strict_provenance_atomic_ptr` feature) - #145756 (str: Stabilize `round_char_boundary` feature) - #145967 (compiler: Include span of too huge enum with `-Cdebuginfo=2`) - #145990 (`AutoDeref::final_ty` is already resolved) - #145991 (std: haiku: fix `B_FIND_PATH_IMAGE_PATH`) - #146000 (Improve librustdoc error when a file creation/modification failed) - #146017 (Mark pipe2 supported in Android) - #146022 (compiler-builtins subtree update) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of #145242 - joboet:tait-split-paths, r=Mark-Simulacrum std: use a TAIT to define `SplitPaths` on UNIX Defining `SplitPaths` as a TAIT allows using closures instead of function pointers for `split` and `map`.
Rollup of 9 pull requests Successful merges: - rust-lang/rust#145242 (std: use a TAIT to define `SplitPaths` on UNIX) - rust-lang/rust#145467 (Stabilize `strict_provenance_atomic_ptr` feature) - rust-lang/rust#145756 (str: Stabilize `round_char_boundary` feature) - rust-lang/rust#145967 (compiler: Include span of too huge enum with `-Cdebuginfo=2`) - rust-lang/rust#145990 (`AutoDeref::final_ty` is already resolved) - rust-lang/rust#145991 (std: haiku: fix `B_FIND_PATH_IMAGE_PATH`) - rust-lang/rust#146000 (Improve librustdoc error when a file creation/modification failed) - rust-lang/rust#146017 (Mark pipe2 supported in Android) - rust-lang/rust#146022 (compiler-builtins subtree update) r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 9 pull requests Successful merges: - rust-lang/rust#145242 (std: use a TAIT to define `SplitPaths` on UNIX) - rust-lang/rust#145467 (Stabilize `strict_provenance_atomic_ptr` feature) - rust-lang/rust#145756 (str: Stabilize `round_char_boundary` feature) - rust-lang/rust#145967 (compiler: Include span of too huge enum with `-Cdebuginfo=2`) - rust-lang/rust#145990 (`AutoDeref::final_ty` is already resolved) - rust-lang/rust#145991 (std: haiku: fix `B_FIND_PATH_IMAGE_PATH`) - rust-lang/rust#146000 (Improve librustdoc error when a file creation/modification failed) - rust-lang/rust#146017 (Mark pipe2 supported in Android) - rust-lang/rust#146022 (compiler-builtins subtree update) r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 9 pull requests Successful merges: - rust-lang/rust#145242 (std: use a TAIT to define `SplitPaths` on UNIX) - rust-lang/rust#145467 (Stabilize `strict_provenance_atomic_ptr` feature) - rust-lang/rust#145756 (str: Stabilize `round_char_boundary` feature) - rust-lang/rust#145967 (compiler: Include span of too huge enum with `-Cdebuginfo=2`) - rust-lang/rust#145990 (`AutoDeref::final_ty` is already resolved) - rust-lang/rust#145991 (std: haiku: fix `B_FIND_PATH_IMAGE_PATH`) - rust-lang/rust#146000 (Improve librustdoc error when a file creation/modification failed) - rust-lang/rust#146017 (Mark pipe2 supported in Android) - rust-lang/rust#146022 (compiler-builtins subtree update) r? `@ghost` `@rustbot` modify labels: rollup
Defining
SplitPathsas a TAIT allows using closures instead of function pointers forsplitandmap.