@@ -530,7 +530,6 @@ pub struct MiriMachine<'tcx> {
530
530
pub ( crate ) rng : RefCell < StdRng > ,
531
531
532
532
/// The allocator used for the machine's `AllocBytes` in native-libs mode.
533
- #[ cfg( target_os = "linux" ) ]
534
533
pub ( crate ) allocator : Option < Rc < RefCell < crate :: alloc:: isolated_alloc:: IsolatedAlloc > > > ,
535
534
536
535
/// The allocation IDs to report when they are being allocated
@@ -554,9 +553,9 @@ pub struct MiriMachine<'tcx> {
554
553
pub ( crate ) basic_block_count : u64 ,
555
554
556
555
/// Handle of the optional shared object file for native functions.
557
- #[ cfg( unix) ]
556
+ #[ cfg( all ( unix, feature = "native-lib" ) ) ]
558
557
pub native_lib : Vec < ( libloading:: Library , std:: path:: PathBuf ) > ,
559
- #[ cfg( not( unix) ) ]
558
+ #[ cfg( not( all ( unix, feature = "native-lib" ) ) ) ]
560
559
pub native_lib : Vec < !> ,
561
560
562
561
/// Run a garbage collector for BorTags every N basic blocks.
@@ -603,7 +602,7 @@ pub struct MiriMachine<'tcx> {
603
602
/// Remembers whether we already warned about an extern type with Stacked Borrows.
604
603
pub ( crate ) sb_extern_type_warned : Cell < bool > ,
605
604
/// Remember whether we already warned about sharing memory with a native call.
606
- #[ cfg ( unix ) ]
605
+ #[ allow ( unused ) ]
607
606
pub ( crate ) native_call_mem_warned : Cell < bool > ,
608
607
/// Remembers which shims have already shown the warning about erroring in isolation.
609
608
pub ( crate ) reject_in_isolation_warned : RefCell < FxHashSet < String > > ,
@@ -718,7 +717,6 @@ impl<'tcx> MiriMachine<'tcx> {
718
717
local_crates,
719
718
extern_statics : FxHashMap :: default ( ) ,
720
719
rng : RefCell :: new ( rng) ,
721
- #[ cfg( target_os = "linux" ) ]
722
720
allocator : if !config. native_lib . is_empty ( ) {
723
721
Some ( Rc :: new ( RefCell :: new ( crate :: alloc:: isolated_alloc:: IsolatedAlloc :: new ( ) ) ) )
724
722
} else { None } ,
@@ -730,7 +728,7 @@ impl<'tcx> MiriMachine<'tcx> {
730
728
report_progress : config. report_progress ,
731
729
basic_block_count : 0 ,
732
730
monotonic_clock : MonotonicClock :: new ( config. isolated_op == IsolatedOp :: Allow ) ,
733
- #[ cfg( unix) ]
731
+ #[ cfg( all ( unix, feature = "native-lib" ) ) ]
734
732
native_lib : config. native_lib . iter ( ) . map ( |lib_file_path| {
735
733
let host_triple = rustc_session:: config:: host_tuple ( ) ;
736
734
let target_triple = tcx. sess . opts . target_triple . tuple ( ) ;
@@ -752,9 +750,9 @@ impl<'tcx> MiriMachine<'tcx> {
752
750
lib_file_path. clone ( ) ,
753
751
)
754
752
} ) . collect ( ) ,
755
- #[ cfg( not( unix) ) ]
753
+ #[ cfg( not( all ( unix, feature = "native-lib" ) ) ) ]
756
754
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 " )
758
756
} ) . collect ( ) ,
759
757
gc_interval : config. gc_interval ,
760
758
since_gc : 0 ,
@@ -771,7 +769,6 @@ impl<'tcx> MiriMachine<'tcx> {
771
769
pthread_rwlock_sanity : Cell :: new ( false ) ,
772
770
pthread_condvar_sanity : Cell :: new ( false ) ,
773
771
sb_extern_type_warned : Cell :: new ( false ) ,
774
- #[ cfg( unix) ]
775
772
native_call_mem_warned : Cell :: new ( false ) ,
776
773
reject_in_isolation_warned : Default :: default ( ) ,
777
774
int2ptr_warned : Default :: default ( ) ,
@@ -924,7 +921,6 @@ impl VisitProvenance for MiriMachine<'_> {
924
921
backtrace_style : _,
925
922
local_crates : _,
926
923
rng : _,
927
- #[ cfg( target_os = "linux" ) ]
928
924
allocator : _,
929
925
tracked_alloc_ids : _,
930
926
track_alloc_accesses : _,
@@ -949,7 +945,6 @@ impl VisitProvenance for MiriMachine<'_> {
949
945
pthread_rwlock_sanity : _,
950
946
pthread_condvar_sanity : _,
951
947
sb_extern_type_warned : _,
952
- #[ cfg ( unix) ]
953
948
native_call_mem_warned : _,
954
949
reject_in_isolation_warned : _,
955
950
int2ptr_warned : _,
@@ -1817,13 +1812,10 @@ impl<'tcx> Machine<'tcx> for MiriMachine<'tcx> {
1817
1812
fn get_default_alloc_params ( & self ) -> <Self :: Bytes as AllocBytes >:: AllocParams {
1818
1813
use crate :: alloc:: MiriAllocParams ;
1819
1814
1820
- #[ cfg( target_os = "linux" ) ]
1821
1815
match & self . allocator {
1822
1816
Some ( alloc) => MiriAllocParams :: Isolated ( alloc. clone ( ) ) ,
1823
1817
None => MiriAllocParams :: Global ,
1824
1818
}
1825
- #[ cfg( not( target_os = "linux" ) ) ]
1826
- MiriAllocParams :: Global
1827
1819
}
1828
1820
1829
1821
fn enter_trace_span ( span : impl FnOnce ( ) -> tracing:: Span ) -> impl EnteredTraceSpan {
0 commit comments