File tree Expand file tree Collapse file tree 1 file changed +4
-7
lines changed Expand file tree Collapse file tree 1 file changed +4
-7
lines changed Original file line number Diff line number Diff line change @@ -684,14 +684,11 @@ thread_local! {
684684
685685/// Sets the thread handle for the current thread.
686686///
687- /// Aborts if the handle has been set already to reduce code size.
687+ /// Does nothing if the thread was already set. This can only happen if some code
688+ /// runs pre-main, but it seems unnecessary to detect that, especially since
689+ /// adding `.unwrap()` here can add ~3kB to the binary size.
688690pub ( crate ) fn set_current ( thread : Thread ) {
689- // Using `unwrap` here can add ~3kB to the binary size. We have complete
690- // control over where this is called, so just abort if there is a bug.
691- CURRENT . with ( |current| match current. set ( thread) {
692- Ok ( ( ) ) => { }
693- Err ( _) => rtabort ! ( "should only be set once" ) ,
694- } ) ;
691+ let _ = CURRENT . with ( |current| current. set ( thread) ) ;
695692}
696693
697694/// Gets a handle to the thread that invokes it.
You can’t perform that action at this time.
0 commit comments