runtime: stabilize runtime::id::Id#7125
Merged
ADD-SP merged 2 commits intotokio-rs:masterfrom Dec 15, 2025
Merged
Conversation
Contributor
Author
|
Closes #5545 |
Member
|
Hi @chinedufn, sorry for the late reply. Do you still want to work on this PR? If so, could you resolve the merge conflicts? If not, may I take over this work? |
This commit stabilizes the `runtime::id::Id`. `runtime::id::Id` uniquely identifies a runtime relative to the parent process' other currently running runtimes. It was introduced in July 2023 and has only received one modification since, where `impl From<NonZeroU32> for Id` was added in December 2023 in 3a4aef1 . ## `std::from::From` implementations This commit removes the runtime `Id`'s `From` implementations. Removing unnecessary publc APIs makes stabilizing the `Id` less risky. Instead, a crate private `Id::new` method has been introduced. This means that as of this commit, users can no longer safely construct an `Id`. Instead, they must get a runtime `Id` from a method such as `Handle::current().id()`. The `Id`'s documentation explains that it is intended to be an opaque handle. Therefore, we should not expose a way to construct one.
1db26b5 to
a4ad7f4
Compare
Contributor
Author
|
Hi. I've rebased this PR onto the latest master branch. Merge conflicts are resolved. |
martin-g
approved these changes
Dec 15, 2025
| @@ -936,7 +936,7 @@ cfg_unstable! { | |||
| /// [unstable]: crate#unstable-features | |||
| /// [`Id`]: struct@crate::runtime::Id | |||
| pub fn id(&self) -> runtime::Id { | |||
Member
There was a problem hiding this comment.
Should this method also be stable now ? Or this will be done sometime later ?
Contributor
Author
There was a problem hiding this comment.
I haven't thought about whether this method should be stable.
Can we land this PR as is and consider stabilizing this separately?
kodiakhq bot
pushed a commit
to pdylanross/fatigue
that referenced
this pull request
Jan 5, 2026
Bumps tokio from 1.48.0 to 1.49.0.
Release notes
Sourced from tokio's releases.
Tokio v1.49.0
1.49.0 (January 3rd, 2026)
Added
net: add support for TCLASS option on IPv6 (#7781)
runtime: stabilize runtime::id::Id (#7125)
task: implement Extend for JoinSet (#7195)
task: stabilize the LocalSet::id() (#7776)
Changed
net: deprecate {TcpStream,TcpSocket}::set_linger (#7752)
Fixed
macros: fix the hygiene issue of join! and try_join! (#7766)
runtime: revert "replace manual vtable definitions with Wake" (#7699)
sync: return TryRecvError::Disconnected from Receiver::try_recv after Receiver::close (#7686)
task: remove unnecessary trait bounds on the Debug implementation (#7720)
Unstable
fs: handle EINTR in fs::write for io-uring (#7786)
fs: support io-uring with tokio::fs::read (#7696)
runtime: disable io-uring on EPERM (#7724)
time: add alternative timer for better multicore scalability (#7467)
Documented
docs: fix a typos in bounded.rs and park.rs (#7817)
io: add SyncIoBridge cross-references to copy and copy_buf (#7798)
io: doc that AsyncWrite does not inherit from std::io::Write (#7705)
metrics: clarify that num_alive_tasks is not strongly consistent (#7614)
net: clarify the cancellation safety of the TcpStream::peek (#7305)
net: clarify the drop behavior of unix::OwnedWriteHalf (#7742)
net: clarify the platform-dependent backlog in TcpSocket docs (#7738)
runtime: mention LocalRuntime in new_current_thread docs (#7820)
sync: add missing period to mpsc::Sender::try_send docs (#7721)
sync: clarify the cancellation safety of oneshot::Receiver (#7780)
sync: improve the docs for the errors of mpsc (#7722)
task: add example for spawn_local usage on local runtime (#7689)
#7125: tokio-rs/tokio#7125
#7195: tokio-rs/tokio#7195
#7305: tokio-rs/tokio#7305
#7467: tokio-rs/tokio#7467
#7614: tokio-rs/tokio#7614
#7686: tokio-rs/tokio#7686
#7689: tokio-rs/tokio#7689
... (truncated)
Commits
e3b89bb chore: prepare Tokio v1.49.0 (#7824)
4f577b8 Merge 'tokio-1.47.3' into 'master'
f320197 chore: prepare Tokio v1.47.3 (#7823)
ea6b144 ci: freeze rustc on nightly-2025-01-25 in netlify.toml (#7652)
264e703 Merge tokio-1.43.4 into tokio-1.47.x (#7822)
dfb0f00 chore: prepare Tokio v1.43.4 (#7821)
4a91f19 ci: fix wasm32-wasip1 tests (#7788)
601c383 ci: upgrade FreeBSD from 14.2 to 14.3 (#7758)
484cb52 sync: return TryRecvError::Disconnected from Receiver::try_recv after `Re...
16f20c3 rt: mention LocalRuntime in new_current_thread docs (#7820)
Additional commits viewable in compare view
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
@dependabot rebase will rebase this PR
@dependabot recreate will recreate this PR, overwriting any edits that have been made to it
@dependabot merge will merge this PR after your CI passes on it
@dependabot squash and merge will squash and merge this PR after your CI passes on it
@dependabot cancel merge will cancel a previously requested merge and block automerging
@dependabot reopen will reopen this PR if it is closed
@dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
@dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
@dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
@dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
@dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This commit stabilizes the
runtime::id::Id.runtime::id::Iduniquely identifies a runtime relative to the parent process' other currently running runtimes.std::from::FromimplementationsThis commit removes the runtime
Id'sFromimplementations.Removing unnecessary public APIs makes stabilizing the
Idless risky. Instead, a crate privateId::newmethod has been introduced.This means that as of this commit, users can no longer safely construct an
Id.Instead, they must get a runtime
Idfrom a method such asHandle::current().id().It is assumed that there is no reason for a user to construct an
Idthemselves. If a use case is found then we can easily add public constructor functions later.