Skip to content

Conversation

@AhoyISki
Copy link

@AhoyISki AhoyISki commented Dec 12, 2025

This PR solves a concern regarding #132951

Considering that the feature has been on nightly for over a year, I would also like to see it stabilized, since no one has voiced any concerns about its current implementation.

@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 Dec 12, 2025
@rustbot
Copy link
Collaborator

rustbot commented Dec 12, 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

///
/// Panics if a thread name was set and it contained null bytes.
///
/// Unlike the [`spawn`] free function, if it panics for this reason, the
Copy link
Member

Choose a reason for hiding this comment

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

Unlike the spawn free function

thread::spawn calls Builder::spawn internally, so this is misleading – it's just that thread::spawn doesn't set a thread name and thus will never panic for this reason.

Copy link
Author

Choose a reason for hiding this comment

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

Ok, I will rephrase.

/// Panics if the OS fails to create a thread; use [`Builder::spawn`] to recover
/// from such errors.
///
/// Additionally, if hooks were added via [`add_spawn_hook`], they will still be
Copy link
Member

Choose a reason for hiding this comment

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

"Additionally" isn't a good phrasing here, this isn't describing another panicking case, but rather adding more detail to the previous sentence. How about just combining the two paragraphs without any conjunction? Like

Panics if the OS fails to create a thread; use Builder::spawn to recover from such errors. If hooks...

/// Panics if the OS fails to create a thread; use [`Builder::spawn_scoped`]
/// to recover from such errors.
///
/// like the free [`spawn`] function, if hooks were added via [`add_spawn_hook`],
Copy link
Member

Choose a reason for hiding this comment

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

This should then match the thread::spawn documentation exactly.

/// Panics if a thread name was set and it contained null bytes.
///
/// Unlike with [`Scope::spawn`], if it panics for this reason, the hooks
/// added by [`add_spawn_hook`] will _not_ be called.
Copy link
Member

Choose a reason for hiding this comment

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

The same nit applies here.

@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 Dec 12, 2025
@rustbot
Copy link
Collaborator

rustbot commented Dec 12, 2025

Reminder, once the PR becomes ready for a review, use @rustbot ready.

Reword documentation for clarity regarding spawn hooks.
Removed unused documentation reference to `spawn` in scoped thread.
@AhoyISki
Copy link
Author

@rustbot ready

@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 Dec 13, 2025
@AhoyISki AhoyISki requested a review from joboet December 13, 2025 02:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

3 participants