Skip to content

Commit

Permalink
Remove a dead type in wasmparser (#1836)
Browse files Browse the repository at this point in the history
Must have been lost in one refactoring or another. Now it's no longer
used though so go ahead and delete it.
  • Loading branch information
alexcrichton authored Oct 2, 2024
1 parent a099aa5 commit a0004ed
Showing 1 changed file with 0 additions and 42 deletions.
42 changes: 0 additions & 42 deletions crates/wasmparser/src/validator/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,18 +244,6 @@ macro_rules! define_type_id {
};
}

/// A core WebAssembly type, in the core WebAssembly types index space.
pub enum CoreType {
/// A sub type.
Sub(SubType),

/// A module type.
///
/// Does not actually appear in core Wasm at the moment. Only used for the
/// core types index space within components.
Module(ModuleType),
}

/// Represents a unique identifier for a core type type known to a
/// [`crate::Validator`].
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
Expand Down Expand Up @@ -303,36 +291,6 @@ impl TypeData for SubType {
}
}

impl CoreType {
/// Get the underlying `SubType` or panic.
pub fn unwrap_sub(&self) -> &SubType {
match self {
CoreType::Sub(s) => s,
CoreType::Module(_) => panic!("`unwrap_sub` on module type"),
}
}

/// Get the underlying `FuncType` within this `SubType` or panic.
pub fn unwrap_func(&self) -> &FuncType {
match &self.unwrap_sub().composite_type.inner {
CompositeInnerType::Func(f) => f,
CompositeInnerType::Array(_)
| CompositeInnerType::Struct(_)
| CompositeInnerType::Cont(_) => {
panic!("`unwrap_func` on non-func composite type")
}
}
}

/// Get the underlying `ModuleType` or panic.
pub fn unwrap_module(&self) -> &ModuleType {
match self {
CoreType::Module(m) => m,
CoreType::Sub(_) => panic!("`unwrap_module` on a subtype"),
}
}
}

macro_rules! define_wrapper_id {
(
$(#[$outer_attrs:meta])*
Expand Down

0 comments on commit a0004ed

Please sign in to comment.