Remove Default implementations from many entity references.

These types can be wrapped in a PackedOption now, so we don't need the
NO_* constants and default values.
This commit is contained in:
Jakob Stoklund Olesen
2017-01-19 13:15:50 -08:00
parent 8a30bae909
commit 7b8239d076

View File

@@ -208,57 +208,21 @@ impl Default for Value {
pub struct StackSlot(u32);
entity_impl!(StackSlot, "ss");
/// A guaranteed invalid stack slot reference.
pub const NO_STACK_SLOT: StackSlot = StackSlot(u32::MAX);
impl Default for StackSlot {
fn default() -> StackSlot {
NO_STACK_SLOT
}
}
/// An opaque reference to a jump table.
#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)]
pub struct JumpTable(u32);
entity_impl!(JumpTable, "jt");
/// A guaranteed invalid jump table reference.
pub const NO_JUMP_TABLE: JumpTable = JumpTable(u32::MAX);
impl Default for JumpTable {
fn default() -> JumpTable {
NO_JUMP_TABLE
}
}
/// A reference to an external function.
#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)]
pub struct FuncRef(u32);
entity_impl!(FuncRef, "fn");
/// A guaranteed invalid function reference.
pub const NO_FUNC_REF: FuncRef = FuncRef(u32::MAX);
impl Default for FuncRef {
fn default() -> FuncRef {
NO_FUNC_REF
}
}
/// A reference to a function signature.
#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)]
pub struct SigRef(u32);
entity_impl!(SigRef, "sig");
/// A guaranteed invalid function reference.
pub const NO_SIG_REF: SigRef = SigRef(u32::MAX);
impl Default for SigRef {
fn default() -> SigRef {
NO_SIG_REF
}
}
/// A reference to any of the entities defined in this module.
#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)]
pub enum AnyEntity {