Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions tokio/src/runtime/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -824,6 +824,9 @@ impl Builder {
/// will immediately terminate and further calls to
/// [`Runtime::block_on`] will panic.
///
/// # Panics
/// This method panics if called on a runtime other than the current thread runtime.
///
/// # Unstable
///
/// This option is currently unstable and its implementation is
Expand Down Expand Up @@ -861,6 +864,10 @@ impl Builder {
///
/// [`JoinHandle`]: struct@crate::task::JoinHandle
pub fn unhandled_panic(&mut self, behavior: UnhandledPanic) -> &mut Self {
if !matches!(self.kind, Kind::CurrentThread) {
panic!("unhandled panic option is only supported in current thread runtime");
}

self.unhandled_panic = behavior;
self
}
Expand Down