File tree Expand file tree Collapse file tree
library/std/src/sys/thread_local/guard
src/tools/miri/src/shims/windows Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -155,9 +155,13 @@ pub fn enable() {
155155 //
156156 // If a main non-Rust binary is exiting, it must not be trigger the `enable` guard
157157 // for the first time during process shutdown.
158- let res = unsafe { c:: atexit ( free_fls_key_at_exit) } ;
159- if res != 0 {
160- rtabort ! ( "failed to register fls atexit hook" ) ;
158+ //
159+ // Miri has no DLL unloading so we can skip this step here.
160+ if !cfg ! ( miri) {
161+ let res = unsafe { c:: atexit ( free_fls_key_at_exit) } ;
162+ if res != 0 {
163+ rtabort ! ( "failed to register fls atexit hook" ) ;
164+ }
161165 }
162166
163167 new_key
Original file line number Diff line number Diff line change @@ -1400,18 +1400,6 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
14001400 // FIXME: this should return a nonzero value if this call does result in switching to another thread.
14011401 this. write_null ( dest) ?;
14021402 }
1403- "atexit" if this. frame_in_std ( ) => {
1404- let [ _value] = this. check_shim_sig (
1405- shim_sig ! ( extern "C" fn ( * const _) -> winapi:: c_int) ,
1406- link_name,
1407- abi,
1408- args,
1409- ) ?;
1410-
1411- // We do not support registering atexit handlers, which is used by the thread-local destructor implementation in std.
1412- // But we also do not support manually unloading DLLs, so this has no visible effect.
1413- this. write_int ( 0 , dest) ?;
1414- }
14151403
14161404 _ => return interp_ok ( EmulateItemResult :: NotSupported ) ,
14171405 }
You can’t perform that action at this time.
0 commit comments