From adc2ae7af2caaea83985fbdfbc7884c159c486f2 Mon Sep 17 00:00:00 2001 From: Motoyuki Kimura Date: Thu, 30 Jul 2026 19:29:09 +0900 Subject: [PATCH] rt: add error documentation for `runtime::Builder` (#8297) --- tokio/src/runtime/builder.rs | 10 ++++++++++ tokio/src/runtime/local_runtime/runtime.rs | 5 +++++ tokio/src/runtime/runtime.rs | 5 +++++ 3 files changed, 20 insertions(+) diff --git a/tokio/src/runtime/builder.rs b/tokio/src/runtime/builder.rs index 4a8252df2..30dd02b73 100644 --- a/tokio/src/runtime/builder.rs +++ b/tokio/src/runtime/builder.rs @@ -1069,6 +1069,11 @@ impl Builder { /// }); /// # } /// ``` + /// + /// # Errors + /// + /// Returns an error if the I/O driver or other OS resources required by the + /// runtime cannot be initialized. pub fn build(&mut self) -> io::Result { match &self.kind { Kind::CurrentThread => self.build_current_thread_runtime(), @@ -1100,6 +1105,11 @@ impl Builder { /// println!("Hello from the Tokio runtime"); /// }); /// ``` + /// + /// # Errors + /// + /// Returns an error if the I/O driver or other OS resources required by the + /// runtime cannot be initialized. pub fn build_local(&mut self, _options: LocalOptions) -> io::Result { match &self.kind { Kind::CurrentThread => self.build_current_thread_local_runtime(), diff --git a/tokio/src/runtime/local_runtime/runtime.rs b/tokio/src/runtime/local_runtime/runtime.rs index 41121622f..6782f425a 100644 --- a/tokio/src/runtime/local_runtime/runtime.rs +++ b/tokio/src/runtime/local_runtime/runtime.rs @@ -86,6 +86,11 @@ impl LocalRuntime { /// // Use the runtime... /// ``` /// + /// # Errors + /// + /// Returns an error if the I/O driver or other OS resources required by the + /// runtime cannot be initialized. + /// /// [mod]: crate::runtime /// [runtime builder]: crate::runtime::Builder pub fn new() -> std::io::Result { diff --git a/tokio/src/runtime/runtime.rs b/tokio/src/runtime/runtime.rs index 6a1d2e45e..0a1a9b35d 100644 --- a/tokio/src/runtime/runtime.rs +++ b/tokio/src/runtime/runtime.rs @@ -165,6 +165,11 @@ impl Runtime { /// // Use the runtime... /// ``` /// + /// # Errors + /// + /// Returns an error if the I/O driver or other OS resources required by the + /// runtime cannot be initialized. + /// /// [mod]: index.html /// [main]: ../attr.main.html /// [threaded scheduler]: index.html#threaded-scheduler