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:
@@ -35,7 +35,6 @@ impl<'all_inst> InstructionGroupBuilder<'all_inst> {
|
|||||||
pub(crate) struct PolymorphicInfo {
|
pub(crate) struct PolymorphicInfo {
|
||||||
pub use_typevar_operand: bool,
|
pub use_typevar_operand: bool,
|
||||||
pub ctrl_typevar: TypeVar,
|
pub ctrl_typevar: TypeVar,
|
||||||
pub other_typevars: Vec<TypeVar>,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
@@ -52,8 +51,6 @@ pub(crate) struct InstructionContent {
|
|||||||
pub operands_in: Vec<Operand>,
|
pub operands_in: Vec<Operand>,
|
||||||
/// Output operands. The output operands must be SSA values or `variable_args`.
|
/// Output operands. The output operands must be SSA values or `variable_args`.
|
||||||
pub operands_out: Vec<Operand>,
|
pub operands_out: Vec<Operand>,
|
||||||
/// Instruction-specific TypeConstraints.
|
|
||||||
pub constraints: Vec<Constraint>,
|
|
||||||
|
|
||||||
/// Instruction format, automatically derived from the input operands.
|
/// Instruction format, automatically derived from the input operands.
|
||||||
pub format: Rc<InstructionFormat>,
|
pub format: Rc<InstructionFormat>,
|
||||||
@@ -296,7 +293,6 @@ impl InstructionBuilder {
|
|||||||
doc: self.doc,
|
doc: self.doc,
|
||||||
operands_in,
|
operands_in,
|
||||||
operands_out,
|
operands_out,
|
||||||
constraints: self.constraints.unwrap_or_else(Vec::new),
|
|
||||||
format: self.format,
|
format: self.format,
|
||||||
polymorphic_info,
|
polymorphic_info,
|
||||||
value_opnums,
|
value_opnums,
|
||||||
@@ -404,11 +400,10 @@ fn verify_polymorphic(
|
|||||||
|| tv.singleton_type().is_some()
|
|| tv.singleton_type().is_some()
|
||||||
{
|
{
|
||||||
match is_ctrl_typevar_candidate(tv, &operands_in, &operands_out) {
|
match is_ctrl_typevar_candidate(tv, &operands_in, &operands_out) {
|
||||||
Ok(other_typevars) => {
|
Ok(_other_typevars) => {
|
||||||
return Some(PolymorphicInfo {
|
return Some(PolymorphicInfo {
|
||||||
use_typevar_operand: true,
|
use_typevar_operand: true,
|
||||||
ctrl_typevar: tv.clone(),
|
ctrl_typevar: tv.clone(),
|
||||||
other_typevars,
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
Err(error_message) => {
|
Err(error_message) => {
|
||||||
@@ -439,12 +434,11 @@ fn verify_polymorphic(
|
|||||||
|
|
||||||
// At this point, if the next unwrap() fails, it means the output type couldn't be used as a
|
// At this point, if the next unwrap() fails, it means the output type couldn't be used as a
|
||||||
// controlling type variable either; panicking is the right behavior.
|
// controlling type variable either; panicking is the right behavior.
|
||||||
let other_typevars = is_ctrl_typevar_candidate(tv, &operands_in, &operands_out).unwrap();
|
is_ctrl_typevar_candidate(tv, &operands_in, &operands_out).unwrap();
|
||||||
|
|
||||||
Some(PolymorphicInfo {
|
Some(PolymorphicInfo {
|
||||||
use_typevar_operand: false,
|
use_typevar_operand: false,
|
||||||
ctrl_typevar: tv.clone(),
|
ctrl_typevar: tv.clone(),
|
||||||
other_typevars,
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -577,6 +577,7 @@ unsafe fn initialize_vmcontext_globals(instance: &Instance) {
|
|||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct OnDemandInstanceAllocator {
|
pub struct OnDemandInstanceAllocator {
|
||||||
mem_creator: Option<Arc<dyn RuntimeMemoryCreator>>,
|
mem_creator: Option<Arc<dyn RuntimeMemoryCreator>>,
|
||||||
|
#[cfg(feature = "async")]
|
||||||
stack_size: usize,
|
stack_size: usize,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -594,8 +595,10 @@ fn borrow_limiter<'a>(
|
|||||||
impl OnDemandInstanceAllocator {
|
impl OnDemandInstanceAllocator {
|
||||||
/// Creates a new on-demand instance allocator.
|
/// Creates a new on-demand instance allocator.
|
||||||
pub fn new(mem_creator: Option<Arc<dyn RuntimeMemoryCreator>>, stack_size: usize) -> Self {
|
pub fn new(mem_creator: Option<Arc<dyn RuntimeMemoryCreator>>, stack_size: usize) -> Self {
|
||||||
|
drop(stack_size); // suppress unused warnings w/o async feature
|
||||||
Self {
|
Self {
|
||||||
mem_creator,
|
mem_creator,
|
||||||
|
#[cfg(feature = "async")]
|
||||||
stack_size,
|
stack_size,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -642,6 +645,7 @@ impl Default for OnDemandInstanceAllocator {
|
|||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self {
|
Self {
|
||||||
mem_creator: None,
|
mem_creator: None,
|
||||||
|
#[cfg(feature = "async")]
|
||||||
stack_size: 0,
|
stack_size: 0,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -907,11 +907,11 @@ impl StackPool {
|
|||||||
pub struct PoolingInstanceAllocator {
|
pub struct PoolingInstanceAllocator {
|
||||||
strategy: PoolingAllocationStrategy,
|
strategy: PoolingAllocationStrategy,
|
||||||
module_limits: ModuleLimits,
|
module_limits: ModuleLimits,
|
||||||
instance_limits: InstanceLimits,
|
|
||||||
// This is manually drop so that the pools unmap their memory before the page fault handler drops.
|
// This is manually drop so that the pools unmap their memory before the page fault handler drops.
|
||||||
instances: mem::ManuallyDrop<InstancePool>,
|
instances: mem::ManuallyDrop<InstancePool>,
|
||||||
#[cfg(all(feature = "async", unix))]
|
#[cfg(all(feature = "async", unix))]
|
||||||
stacks: StackPool,
|
stacks: StackPool,
|
||||||
|
#[cfg(all(feature = "async", windows))]
|
||||||
stack_size: usize,
|
stack_size: usize,
|
||||||
#[cfg(all(feature = "uffd", target_os = "linux"))]
|
#[cfg(all(feature = "uffd", target_os = "linux"))]
|
||||||
_fault_handler: imp::PageFaultHandler,
|
_fault_handler: imp::PageFaultHandler,
|
||||||
@@ -935,13 +935,15 @@ impl PoolingInstanceAllocator {
|
|||||||
#[cfg(all(feature = "uffd", target_os = "linux"))]
|
#[cfg(all(feature = "uffd", target_os = "linux"))]
|
||||||
let _fault_handler = imp::PageFaultHandler::new(&instances)?;
|
let _fault_handler = imp::PageFaultHandler::new(&instances)?;
|
||||||
|
|
||||||
|
drop(stack_size); // suppress unused warnings w/o async feature
|
||||||
|
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
strategy,
|
strategy,
|
||||||
module_limits,
|
module_limits,
|
||||||
instance_limits,
|
|
||||||
instances: mem::ManuallyDrop::new(instances),
|
instances: mem::ManuallyDrop::new(instances),
|
||||||
#[cfg(all(feature = "async", unix))]
|
#[cfg(all(feature = "async", unix))]
|
||||||
stacks: StackPool::new(&instance_limits, stack_size)?,
|
stacks: StackPool::new(&instance_limits, stack_size)?,
|
||||||
|
#[cfg(all(feature = "async", windows))]
|
||||||
stack_size,
|
stack_size,
|
||||||
#[cfg(all(feature = "uffd", target_os = "linux"))]
|
#[cfg(all(feature = "uffd", target_os = "linux"))]
|
||||||
_fault_handler,
|
_fault_handler,
|
||||||
|
|||||||
Reference in New Issue
Block a user