Skip to content

std: reduce visibility of some internal OsStr related types - #161589

Merged
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
pacak:private-osstr
Aug 24, 2026
Merged

std: reduce visibility of some internal OsStr related types#161589
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
pacak:private-osstr

Conversation

@pacak

@pacak pacak commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

The std::sys::os_str::{Buf, Slice} types are only used within the std crate and not actually exported. Whole sys module is private. They don't need to be public. This might result in a better generated code, but more importantly it avoids some compile errors down the line.

This commit is extracted from #160971

The std::sys::os_str::{Buf, Slice} types are only used within the std
crate and not actually exported. Whole `sys` module is private. They
don't need to be public. This might result in a better generated code,
but more importantly it avoids some compile errors down the line.
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 23, 2026
@rustbot rustbot added the T-libs Relevant to the library team, which will review and decide on the PR/issue. label Aug 23, 2026
@rustbot

rustbot commented Aug 23, 2026

Copy link
Copy Markdown
Collaborator

r? @JohnTitor

rustbot has assigned @JohnTitor.
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

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: @ChrisDenton, libs
  • @ChrisDenton, libs expanded to 13 candidates
  • Random selection from ChrisDenton, JohnTitor, Mark-Simulacrum, clarfonthey, nia-e

@clarfonthey

Copy link
Copy Markdown
Contributor

I thought we had unreachable_pub firing for all of the standard library? That would catch things like this.

@pacak

pacak commented Aug 23, 2026

Copy link
Copy Markdown
Contributor Author

I thought we had unreachable_pub firing for all of the standard library? That would catch things like this.

% jj diff --tool :git
diff --git a/library/std/src/lib.rs b/library/std/src/lib.rs
index 980ec4416f..670c1e8c0a 100644
--- a/library/std/src/lib.rs
+++ b/library/std/src/lib.rs
@@ -241,6 +241,7 @@
 // Lints:
 #![warn(deprecated_in_future)]
 #![warn(missing_docs)]
+#![warn(unreachable_pub)]
 #![warn(missing_debug_implementations)]
 #![allow(explicit_outlives_requirements)]
 #![allow(unused_lifetimes)]
error: `std` (lib) generated 868 warnings (run `cargo fix --lib -p std` to apply 865 suggestions)

@pacak

pacak commented Aug 23, 2026

Copy link
Copy Markdown
Contributor Author

I can make a separate pull request for all that stuff I guess. Want to keep this focused on #160971 related stuff.

@clarfonthey

Copy link
Copy Markdown
Contributor

Fair enough. I'll just merge this then.

@bors r+ rollup

@rust-bors

rust-bors Bot commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 00be974 has been approved by clarfonthey

It is now in the queue for this repository.

@rust-bors rust-bors Bot 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 Aug 23, 2026
@clarfonthey clarfonthey assigned clarfonthey and unassigned JohnTitor Aug 23, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Aug 23, 2026
std: reduce visibility of some internal OsStr related types

The std::sys::os_str::{Buf, Slice} types are only used within the std crate and not actually exported. Whole `sys` module is private. They don't need to be public. This might result in a better generated code, but more importantly it avoids some compile errors down the line.

This commit is extracted from rust-lang#160971
rust-bors Bot pushed a commit that referenced this pull request Aug 23, 2026
…uwer

Rollup of 14 pull requests

Successful merges:

 - #160302 (target_features: sse (or at least avx2) is incompatible with soft-float ABI)
 - #161187 (add `Complex<T>` layout tests for straightforward targets)
 - #161524 (Put back `tests/rustdoc-gui/search-result-display.goml`)
 - #161586 (miri subtree update)
 - #155254 (Recover on attribute in use tree)
 - #158695 (Replace `CrateDump` with the Debug impl from `CStore`)
 - #160452 (-Ctarget-feature is not unsafe (any more))
 - #161007 (tests/ui/union/union-nodrop.rs: fix typo "expressios")
 - #161166 (add crashtests [5/N], remove unused aux files )
 - #161569 (Bump cfg_aliases to 0.2.2)
 - #161573 (re-bless `pretty-std` on windows)
 - #161588 (update eyre)
 - #161589 (std: reduce visibility of some internal OsStr related types)
 - #161598 ([Bootstrap] Pass exact CI `llvm-config` executable path)
rust-bors Bot pushed a commit that referenced this pull request Aug 23, 2026
…uwer

Rollup of 14 pull requests

Successful merges:

 - #160302 (target_features: sse (or at least avx2) is incompatible with soft-float ABI)
 - #161187 (add `Complex<T>` layout tests for straightforward targets)
 - #161524 (Put back `tests/rustdoc-gui/search-result-display.goml`)
 - #161586 (miri subtree update)
 - #155254 (Recover on attribute in use tree)
 - #158695 (Replace `CrateDump` with the Debug impl from `CStore`)
 - #160452 (-Ctarget-feature is not unsafe (any more))
 - #161007 (tests/ui/union/union-nodrop.rs: fix typo "expressios")
 - #161166 (add crashtests [5/N], remove unused aux files )
 - #161569 (Bump cfg_aliases to 0.2.2)
 - #161573 (re-bless `pretty-std` on windows)
 - #161588 (update eyre)
 - #161589 (std: reduce visibility of some internal OsStr related types)
 - #161598 ([Bootstrap] Pass exact CI `llvm-config` executable path)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Aug 23, 2026
std: reduce visibility of some internal OsStr related types

The std::sys::os_str::{Buf, Slice} types are only used within the std crate and not actually exported. Whole `sys` module is private. They don't need to be public. This might result in a better generated code, but more importantly it avoids some compile errors down the line.

This commit is extracted from rust-lang#160971
rust-bors Bot pushed a commit that referenced this pull request Aug 23, 2026
…uwer

Rollup of 17 pull requests

Successful merges:

 - #161187 (add `Complex<T>` layout tests for straightforward targets)
 - #161524 (Put back `tests/rustdoc-gui/search-result-display.goml`)
 - #161592 (core: refactor tests/pattern.rs tests)
 - #161602 (Fix flakyness issue for `tests/rustdoc-gui/headers-color.goml`)
 - #155254 (Recover on attribute in use tree)
 - #158695 (Replace `CrateDump` with the Debug impl from `CStore`)
 - #159456 (Fix the reporting of layout normalization failures in transmute checks)
 - #160452 (-Ctarget-feature is not unsafe (any more))
 - #161007 (tests/ui/union/union-nodrop.rs: fix typo "expressios")
 - #161166 (add crashtests [5/N], remove unused aux files )
 - #161569 (Bump cfg_aliases to 0.2.2)
 - #161573 (re-bless `pretty-std` on windows)
 - #161588 (update eyre)
 - #161589 (std: reduce visibility of some internal OsStr related types)
 - #161598 ([Bootstrap] Pass exact CI `llvm-config` executable path)
 - #161601 (Path: use optimized is_empty() method)
 - #161604 (coretests: Add a few tests for backward multibyte predicate)
Zalathar added a commit to Zalathar/rust that referenced this pull request Aug 24, 2026
std: reduce visibility of some internal OsStr related types

The std::sys::os_str::{Buf, Slice} types are only used within the std crate and not actually exported. Whole `sys` module is private. They don't need to be public. This might result in a better generated code, but more importantly it avoids some compile errors down the line.

This commit is extracted from rust-lang#160971
rust-bors Bot pushed a commit that referenced this pull request Aug 24, 2026
Rollup of 24 pull requests

Successful merges:

 - #161586 (miri subtree update)
 - #161187 (add `Complex<T>` layout tests for straightforward targets)
 - #161524 (Put back `tests/rustdoc-gui/search-result-display.goml`)
 - #161592 (core: refactor tests/pattern.rs tests)
 - #161602 (Fix flakyness issue for `tests/rustdoc-gui/headers-color.goml`)
 - #152433 (Use `symlink_dir` to create junctions on Windows instead of trying to use symbolic links in `copy_link_internal`)
 - #155254 (Recover on attribute in use tree)
 - #158695 (Replace `CrateDump` with the Debug impl from `CStore`)
 - #159456 (Fix the reporting of layout normalization failures in transmute checks)
 - #159940 (Eliminate some buggy `unreachable!()`s in `expand_[option_]env()`)
 - #160452 (-Ctarget-feature is not unsafe (any more))
 - #161007 (tests/ui/union/union-nodrop.rs: fix typo "expressios")
 - #161166 (add crashtests [5/N], remove unused aux files )
 - #161294 (add crashtests [6/N])
 - #161552 (also trigger overflow FCW when going from overflow -> error)
 - #161569 (Bump cfg_aliases to 0.2.2)
 - #161573 (re-bless `pretty-std` on windows)
 - #161580 (Add codegen test for redundant bit mask after a range check)
 - #161588 (update eyre)
 - #161589 (std: reduce visibility of some internal OsStr related types)
 - #161598 ([Bootstrap] Pass exact CI `llvm-config` executable path)
 - #161601 (Path: use optimized is_empty() method)
 - #161604 (coretests: Add a few tests for backward multibyte predicate)
 - #161615 (interpret: make validate_c_variadic_compatible_ty public)
rust-bors Bot pushed a commit that referenced this pull request Aug 24, 2026
Rollup of 22 pull requests

Successful merges:

 - #161586 (miri subtree update)
 - #161187 (add `Complex<T>` layout tests for straightforward targets)
 - #161524 (Put back `tests/rustdoc-gui/search-result-display.goml`)
 - #161592 (core: refactor tests/pattern.rs tests)
 - #161602 (Fix flakyness issue for `tests/rustdoc-gui/headers-color.goml`)
 - #152433 (Use `symlink_dir` to create junctions on Windows instead of trying to use symbolic links in `copy_link_internal`)
 - #155254 (Recover on attribute in use tree)
 - #158695 (Replace `CrateDump` with the Debug impl from `CStore`)
 - #159456 (Fix the reporting of layout normalization failures in transmute checks)
 - #159940 (Eliminate some buggy `unreachable!()`s in `expand_[option_]env()`)
 - #160452 (-Ctarget-feature is not unsafe (any more))
 - #161007 (tests/ui/union/union-nodrop.rs: fix typo "expressios")
 - #161552 (also trigger overflow FCW when going from overflow -> error)
 - #161569 (Bump cfg_aliases to 0.2.2)
 - #161573 (re-bless `pretty-std` on windows)
 - #161580 (Add codegen test for redundant bit mask after a range check)
 - #161588 (update eyre)
 - #161589 (std: reduce visibility of some internal OsStr related types)
 - #161598 ([Bootstrap] Pass exact CI `llvm-config` executable path)
 - #161601 (Path: use optimized is_empty() method)
 - #161604 (coretests: Add a few tests for backward multibyte predicate)
 - #161615 (interpret: make validate_c_variadic_compatible_ty public)
@rust-bors
rust-bors Bot merged commit a0dd6f5 into rust-lang:main Aug 24, 2026
13 checks passed
@rustbot rustbot added this to the 1.100.0 milestone Aug 24, 2026
rust-bors Bot pushed a commit that referenced this pull request Aug 24, 2026
Rollup merge of #161589 - pacak:private-osstr, r=clarfonthey

std: reduce visibility of some internal OsStr related types

The std::sys::os_str::{Buf, Slice} types are only used within the std crate and not actually exported. Whole `sys` module is private. They don't need to be public. This might result in a better generated code, but more importantly it avoids some compile errors down the line.

This commit is extracted from #160971
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.

4 participants