Skip to content

rt: introduce runtime name#7924

Merged
Darksonn merged 38 commits intotokio-rs:masterfrom
mattiapitossi:5545
Apr 1, 2026
Merged

rt: introduce runtime name#7924
Darksonn merged 38 commits intotokio-rs:masterfrom
mattiapitossi:5545

Conversation

@mattiapitossi
Copy link
Copy Markdown
Member

@mattiapitossi mattiapitossi commented Feb 20, 2026

@github-actions github-actions Bot added R-loom-current-thread Run loom current-thread tests on this PR R-loom-multi-thread Run loom multi-thread tests on this PR labels Feb 20, 2026

impl MultiThread {
#[allow(clippy::too_many_arguments)]
pub(crate) fn new(
Copy link
Copy Markdown
Member Author

@mattiapitossi mattiapitossi Feb 20, 2026

Choose a reason for hiding this comment

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

Not sure what to do here, I don't feel like name should be in Config, maybe we should moving some other field? Or maybe allowing too_many_arguments in this case might be OK

/// # }
/// # }
/// ```
pub fn name(&mut self, val: impl Into<String>) -> &mut Self {
Copy link
Copy Markdown
Member Author

@mattiapitossi mattiapitossi Feb 20, 2026

Choose a reason for hiding this comment

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

Do you think this new API should be gated behind the unstable ff?

Comment thread tokio-macros/src/entry.rs
}

struct FinalConfig {
name: Option<String>,
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.

probably the name could be the first in the order, and so for the diagnostics

@Darksonn Darksonn added A-tokio Area: The main tokio crate M-runtime Module: tokio/runtime labels Feb 20, 2026
@mattiapitossi mattiapitossi marked this pull request as ready for review February 21, 2026 09:08
@mattiapitossi
Copy link
Copy Markdown
Member Author

This is ready for review. I've left some comments regarding few things that might need to be discussed.

Comment thread tokio/src/runtime/builder.rs
Comment thread tokio/src/runtime/scheduler/current_thread/mod.rs Outdated
Comment thread tokio/src/runtime/scheduler/multi_thread/handle.rs Outdated
Comment thread tokio/src/runtime/builder.rs
Copy link
Copy Markdown
Member

@martin-g martin-g left a comment

Choose a reason for hiding this comment

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

A few more test could be added too:

  • a test with #[tokio::test(name = "a valid name")] and an assertion that the runtime's name() returns "a valid name"
  • rt_threaded.rs has a test for multi-thread. It would be good to add similar for current-thread
  • a test for unnamed runtime, i.e. assert None

@Darksonn Darksonn enabled auto-merge (squash) April 1, 2026 09:28
@Darksonn Darksonn merged commit 7947fa4 into tokio-rs:master Apr 1, 2026
93 checks passed
@mattiapitossi mattiapitossi deleted the 5545 branch April 1, 2026 10:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-tokio Area: The main tokio crate M-runtime Module: tokio/runtime R-loom-current-thread Run loom current-thread tests on this PR R-loom-multi-thread Run loom multi-thread tests on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Runtime identifier and name

3 participants