@@ -92,8 +92,7 @@ trait EvalContextExtPriv<'tcx>: crate::MiriInterpCxExt<'tcx> {
9292 fn get_func_ptr_explicitly_from_lib ( & mut self , link_name : Symbol ) -> Option < CodePtr > {
9393 let this = self . eval_context_mut ( ) ;
9494 // Try getting the function from the shared library.
95- // On windows `_lib_path` will be unused, hence the name starting with `_`.
96- let ( lib, _lib_path) = this. machine . native_lib . as_ref ( ) . unwrap ( ) ;
95+ let ( lib, lib_path) = this. machine . native_lib . as_ref ( ) . unwrap ( ) ;
9796 let func: libloading:: Symbol < ' _ , unsafe extern "C" fn ( ) > = unsafe {
9897 match lib. get ( link_name. as_str ( ) . as_bytes ( ) ) {
9998 Ok ( x) => x,
@@ -114,16 +113,17 @@ trait EvalContextExtPriv<'tcx>: crate::MiriInterpCxExt<'tcx> {
114113 // This code is a reimplementation of the mechanism for getting `dli_fname` in `libloading`,
115114 // from: https://docs.rs/libloading/0.7.3/src/libloading/os/unix/mod.rs.html#411
116115 // using the `libc` crate where this interface is public.
117- let mut info = std:: mem:: MaybeUninit :: < libc:: Dl_info > :: uninit ( ) ;
116+ let mut info = std:: mem:: MaybeUninit :: < libc:: Dl_info > :: zeroed ( ) ;
118117 unsafe {
119118 if libc:: dladdr ( * func. deref ( ) as * const _ , info. as_mut_ptr ( ) ) != 0 {
120119 let info = info. assume_init ( ) ;
121120 #[ cfg( target_os = "cygwin" ) ]
122121 let fname_ptr = info. dli_fname . as_ptr ( ) ;
123122 #[ cfg( not( target_os = "cygwin" ) ) ]
124123 let fname_ptr = info. dli_fname ;
124+ assert ! ( !fname_ptr. is_null( ) ) ;
125125 if std:: ffi:: CStr :: from_ptr ( fname_ptr) . to_str ( ) . unwrap ( )
126- != _lib_path . to_str ( ) . unwrap ( )
126+ != lib_path . to_str ( ) . unwrap ( )
127127 {
128128 return None ;
129129 }
0 commit comments