File tree 1 file changed +8
-0
lines changed
1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -824,6 +824,10 @@ impl Builder {
824
824
/// will immediately terminate and further calls to
825
825
/// [`Runtime::block_on`] will panic.
826
826
///
827
+ /// # Panics
828
+ /// This method panics if called with [`UnhandledPanic::ShutdownRuntime`]
829
+ /// on a runtime other than the current thread runtime.
830
+ ///
827
831
/// # Unstable
828
832
///
829
833
/// This option is currently unstable and its implementation is
@@ -861,6 +865,10 @@ impl Builder {
861
865
///
862
866
/// [`JoinHandle`]: struct@crate::task::JoinHandle
863
867
pub fn unhandled_panic( & mut self , behavior: UnhandledPanic ) -> & mut Self {
868
+ if !matches!( self . kind, Kind :: CurrentThread ) && matches!( behavior, UnhandledPanic :: ShutdownRuntime ) {
869
+ panic!( "UnhandledPanic::ShutdownRuntime is only supported in current thread runtime" ) ;
870
+ }
871
+
864
872
self . unhandled_panic = behavior;
865
873
self
866
874
}
You can’t perform that action at this time.
0 commit comments