Skip to content

Use impl restrictions in std, core#157170

Open
jhpratt wants to merge 2 commits into
rust-lang:mainfrom
jhpratt:dogfood-restrictions
Open

Use impl restrictions in std, core#157170
jhpratt wants to merge 2 commits into
rust-lang:mainfrom
jhpratt:dogfood-restrictions

Conversation

@jhpratt
Copy link
Copy Markdown
Member

@jhpratt jhpratt commented May 30, 2026

This should all be quite self-explanatory. I've used the tightest module permitted by current implementation, which is overwhelmingly self as I had expected.

r? @Urgau

@rustbot rustbot added O-apple Operating system: Apple / Darwin (macOS, iOS, tvOS, visionOS, watchOS) O-linux Operating system: Linux O-netbsd Operating system: NetBSD O-solaris Operating system: Solaris 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 May 30, 2026
@rust-log-analyzer

This comment has been minimized.

/// Trait to determine if a descriptor/handle refers to a terminal/tty.
#[stable(feature = "is_terminal", since = "1.70.0")]
pub trait IsTerminal: crate::sealed::Sealed {
pub impl(crate) trait IsTerminal {
Copy link
Copy Markdown
Member

@fmease fmease May 30, 2026

Choose a reason for hiding this comment

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

Don't we want to block this PR on rustdoc support?

IsTerminal is stable and AFAICT the docs don't mention anywhere that the trait is sealed, so if we were to merge your PR now, users would no longer know that the trait is sealed just by looking at the docs. That feels unfortunate.

View changes since the review

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I'm not opposed to blocking it on such. I deliberately left any "this trait is sealed" comments for that reason. Once there's rustdoc support, all of those can be removed as well.

@jhpratt jhpratt force-pushed the dogfood-restrictions branch 2 times, most recently from a6278c5 to 4bdbe8a Compare May 30, 2026 21:51
@rust-log-analyzer

This comment has been minimized.

@jhpratt jhpratt force-pushed the dogfood-restrictions branch from 4bdbe8a to ce88386 Compare May 30, 2026 22:56
@jhpratt
Copy link
Copy Markdown
Member Author

jhpratt commented May 30, 2026

CI will certainly fail again. x c core, x c std, and x c rustfmt all pass, but x t tidy fails at the rustfmt step. This is presumably due to the keyword order changing, but a bootstrap has taken place since that happened. What am I missing here?

@rust-log-analyzer
Copy link
Copy Markdown
Collaborator

The job tidy failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
fmt check
error: expected type, found keyword `unsafe`
##[error]  --> /checkout/library/core/src/num/nonzero.rs:34:16
   |
34 | pub impl(self) unsafe trait ZeroablePrimitive: Sized + Copy {
   |                ^^^^^^ expected type

error: expected one of `for`, `where`, or `{`, found keyword `const`
##[error] --> /checkout/library/core/src/num/traits.rs:7:16
  |
7 | pub impl(self) const trait TruncateTarget<Target> {
  |                ^^^^^ expected one of `for`, `where`, or `{`

error: expected type, found keyword `unsafe`
##[error]    --> /checkout/library/core/src/slice/mod.rs:5750:16
     |
5750 | pub impl(self) unsafe trait GetDisjointMutIndex: Clone {
     |                ^^^^^^ expected type

error: expected one of `for`, `where`, or `{`, found keyword `const`
##[error]   --> /checkout/library/core/src/slice/index.rs:123:17
    |
123 | pub impl(crate) const unsafe trait SliceIndex<T: ?Sized> {
    |                 ^^^^^ expected one of `for`, `where`, or `{`

error: expected type, found keyword `unsafe`
##[error]   --> /checkout/library/core/src/sync/atomic.rs:292:16
    |
292 | pub impl(self) unsafe trait AtomicPrimitive: Sized + Copy {
    |                ^^^^^^ expected type

error: expected type, found keyword `unsafe`
##[error]   --> /checkout/library/core/src/ffi/va_list.rs:316:16
    |
316 | pub impl(self) unsafe trait VaArgSafe: Copy {}
    |                ^^^^^^ expected type

fmt: checked 6874 files
Bootstrap failed while executing `test src/tools/tidy tidyselftest --extra-checks=py,cpp,js,spellcheck`
Build completed unsuccessfully in 0:00:46

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented May 31, 2026

☔ The latest upstream changes (presumably #157174) made this pull request unmergeable. Please resolve the merge conflicts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

O-apple Operating system: Apple / Darwin (macOS, iOS, tvOS, visionOS, watchOS) O-linux Operating system: Linux O-netbsd Operating system: NetBSD O-solaris Operating system: Solaris 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants