@@ -530,7 +530,6 @@ pub struct MiriMachine<'tcx> {
530530 pub ( crate ) rng : RefCell < StdRng > ,
531531
532532 /// The allocator used for the machine's `AllocBytes` in native-libs mode.
533- #[ cfg( target_os = "linux" ) ]
534533 pub ( crate ) allocator : Option < Rc < RefCell < crate :: alloc:: isolated_alloc:: IsolatedAlloc > > > ,
535534
536535 /// The allocation IDs to report when they are being allocated
@@ -554,9 +553,9 @@ pub struct MiriMachine<'tcx> {
554553 pub ( crate ) basic_block_count : u64 ,
555554
556555 /// Handle of the optional shared object file for native functions.
557- #[ cfg( unix) ]
556+ #[ cfg( all ( unix, feature = "native-lib" ) ) ]
558557 pub native_lib : Vec < ( libloading:: Library , std:: path:: PathBuf ) > ,
559- #[ cfg( not( unix) ) ]
558+ #[ cfg( not( all ( unix, feature = "native-lib" ) ) ) ]
560559 pub native_lib : Vec < !> ,
561560
562561 /// Run a garbage collector for BorTags every N basic blocks.
@@ -603,7 +602,7 @@ pub struct MiriMachine<'tcx> {
603602 /// Remembers whether we already warned about an extern type with Stacked Borrows.
604603 pub ( crate ) sb_extern_type_warned : Cell < bool > ,
605604 /// Remember whether we already warned about sharing memory with a native call.
606- #[ cfg ( unix ) ]
605+ #[ allow ( unused ) ]
607606 pub ( crate ) native_call_mem_warned : Cell < bool > ,
608607 /// Remembers which shims have already shown the warning about erroring in isolation.
609608 pub ( crate ) reject_in_isolation_warned : RefCell < FxHashSet < String > > ,
@@ -718,7 +717,6 @@ impl<'tcx> MiriMachine<'tcx> {
718717 local_crates,
719718 extern_statics : FxHashMap :: default ( ) ,
720719 rng : RefCell :: new ( rng) ,
721- #[ cfg( target_os = "linux" ) ]
722720 allocator : if !config. native_lib . is_empty ( ) {
723721 Some ( Rc :: new ( RefCell :: new ( crate :: alloc:: isolated_alloc:: IsolatedAlloc :: new ( ) ) ) )
724722 } else { None } ,
@@ -730,7 +728,7 @@ impl<'tcx> MiriMachine<'tcx> {
730728 report_progress : config. report_progress ,
731729 basic_block_count : 0 ,
732730 monotonic_clock : MonotonicClock :: new ( config. isolated_op == IsolatedOp :: Allow ) ,
733- #[ cfg( unix) ]
731+ #[ cfg( all ( unix, feature = "native-lib" ) ) ]
734732 native_lib : config. native_lib . iter ( ) . map ( |lib_file_path| {
735733 let host_triple = rustc_session:: config:: host_tuple ( ) ;
736734 let target_triple = tcx. sess . opts . target_triple . tuple ( ) ;
@@ -752,9 +750,9 @@ impl<'tcx> MiriMachine<'tcx> {
752750 lib_file_path. clone ( ) ,
753751 )
754752 } ) . collect ( ) ,
755- #[ cfg( not( unix) ) ]
753+ #[ cfg( not( all ( unix, feature = "native-lib" ) ) ) ]
756754 native_lib : config. native_lib . iter ( ) . map ( |_| {
757- panic ! ( "calling functions from native libraries via FFI is only supported on Unix " )
755+ panic ! ( "calling functions from native libraries via FFI is not supported in this build of Miri " )
758756 } ) . collect ( ) ,
759757 gc_interval : config. gc_interval ,
760758 since_gc : 0 ,
@@ -771,7 +769,6 @@ impl<'tcx> MiriMachine<'tcx> {
771769 pthread_rwlock_sanity : Cell :: new ( false ) ,
772770 pthread_condvar_sanity : Cell :: new ( false ) ,
773771 sb_extern_type_warned : Cell :: new ( false ) ,
774- #[ cfg( unix) ]
775772 native_call_mem_warned : Cell :: new ( false ) ,
776773 reject_in_isolation_warned : Default :: default ( ) ,
777774 int2ptr_warned : Default :: default ( ) ,
@@ -924,7 +921,6 @@ impl VisitProvenance for MiriMachine<'_> {
924921 backtrace_style : _,
925922 local_crates : _,
926923 rng : _,
927- #[ cfg( target_os = "linux" ) ]
928924 allocator : _,
929925 tracked_alloc_ids : _,
930926 track_alloc_accesses : _,
@@ -949,7 +945,6 @@ impl VisitProvenance for MiriMachine<'_> {
949945 pthread_rwlock_sanity : _,
950946 pthread_condvar_sanity : _,
951947 sb_extern_type_warned : _,
952- #[ cfg ( unix) ]
953948 native_call_mem_warned : _,
954949 reject_in_isolation_warned : _,
955950 int2ptr_warned : _,
@@ -1817,13 +1812,10 @@ impl<'tcx> Machine<'tcx> for MiriMachine<'tcx> {
18171812 fn get_default_alloc_params ( & self ) -> <Self :: Bytes as AllocBytes >:: AllocParams {
18181813 use crate :: alloc:: MiriAllocParams ;
18191814
1820- #[ cfg( target_os = "linux" ) ]
18211815 match & self . allocator {
18221816 Some ( alloc) => MiriAllocParams :: Isolated ( alloc. clone ( ) ) ,
18231817 None => MiriAllocParams :: Global ,
18241818 }
1825- #[ cfg( not( target_os = "linux" ) ) ]
1826- MiriAllocParams :: Global
18271819 }
18281820
18291821 fn enter_trace_span ( span : impl FnOnce ( ) -> tracing:: Span ) -> impl EnteredTraceSpan {
0 commit comments