Fix some nightly dead code warnings (#3404)
* Fix some nightly dead code warnings Looks like the "struct field not used" lint has improved on nightly and caught a few more instances of fields that were never actually read. * Fix windows
This commit is contained in:
@@ -577,6 +577,7 @@ unsafe fn initialize_vmcontext_globals(instance: &Instance) {
|
||||
#[derive(Clone)]
|
||||
pub struct OnDemandInstanceAllocator {
|
||||
mem_creator: Option<Arc<dyn RuntimeMemoryCreator>>,
|
||||
#[cfg(feature = "async")]
|
||||
stack_size: usize,
|
||||
}
|
||||
|
||||
@@ -594,8 +595,10 @@ fn borrow_limiter<'a>(
|
||||
impl OnDemandInstanceAllocator {
|
||||
/// Creates a new on-demand instance allocator.
|
||||
pub fn new(mem_creator: Option<Arc<dyn RuntimeMemoryCreator>>, stack_size: usize) -> Self {
|
||||
drop(stack_size); // suppress unused warnings w/o async feature
|
||||
Self {
|
||||
mem_creator,
|
||||
#[cfg(feature = "async")]
|
||||
stack_size,
|
||||
}
|
||||
}
|
||||
@@ -642,6 +645,7 @@ impl Default for OnDemandInstanceAllocator {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
mem_creator: None,
|
||||
#[cfg(feature = "async")]
|
||||
stack_size: 0,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -907,11 +907,11 @@ impl StackPool {
|
||||
pub struct PoolingInstanceAllocator {
|
||||
strategy: PoolingAllocationStrategy,
|
||||
module_limits: ModuleLimits,
|
||||
instance_limits: InstanceLimits,
|
||||
// This is manually drop so that the pools unmap their memory before the page fault handler drops.
|
||||
instances: mem::ManuallyDrop<InstancePool>,
|
||||
#[cfg(all(feature = "async", unix))]
|
||||
stacks: StackPool,
|
||||
#[cfg(all(feature = "async", windows))]
|
||||
stack_size: usize,
|
||||
#[cfg(all(feature = "uffd", target_os = "linux"))]
|
||||
_fault_handler: imp::PageFaultHandler,
|
||||
@@ -935,13 +935,15 @@ impl PoolingInstanceAllocator {
|
||||
#[cfg(all(feature = "uffd", target_os = "linux"))]
|
||||
let _fault_handler = imp::PageFaultHandler::new(&instances)?;
|
||||
|
||||
drop(stack_size); // suppress unused warnings w/o async feature
|
||||
|
||||
Ok(Self {
|
||||
strategy,
|
||||
module_limits,
|
||||
instance_limits,
|
||||
instances: mem::ManuallyDrop::new(instances),
|
||||
#[cfg(all(feature = "async", unix))]
|
||||
stacks: StackPool::new(&instance_limits, stack_size)?,
|
||||
#[cfg(all(feature = "async", windows))]
|
||||
stack_size,
|
||||
#[cfg(all(feature = "uffd", target_os = "linux"))]
|
||||
_fault_handler,
|
||||
|
||||
Reference in New Issue
Block a user