diff --git a/cranelift/entity/src/primary.rs b/cranelift/entity/src/primary.rs index 257cb240f4..6734a1f5e5 100644 --- a/cranelift/entity/src/primary.rs +++ b/cranelift/entity/src/primary.rs @@ -27,7 +27,7 @@ use std::vec::Vec; /// that it only allows indexing with the distinct `EntityRef` key type, so converting to a /// plain slice would make it easier to use incorrectly. To make a slice of a `PrimaryMap`, use /// `into_boxed_slice`. -#[derive(Debug, Clone)] +#[derive(Debug, Clone, Hash)] #[cfg_attr(feature = "enable-serde", derive(Serialize, Deserialize))] pub struct PrimaryMap where diff --git a/cranelift/wasm/src/translation_utils.rs b/cranelift/wasm/src/translation_utils.rs index 759e4ab4ff..a41c70c4d9 100644 --- a/cranelift/wasm/src/translation_utils.rs +++ b/cranelift/wasm/src/translation_utils.rs @@ -54,7 +54,7 @@ pub struct SignatureIndex(u32); entity_impl!(SignatureIndex); /// WebAssembly global. -#[derive(Debug, Clone, Copy)] +#[derive(Debug, Clone, Copy, Hash)] pub struct Global { /// The type of the value stored in the global. pub ty: ir::Type, @@ -65,7 +65,7 @@ pub struct Global { } /// Globals are initialized via the four `const` operators or by referring to another import. -#[derive(Debug, Clone, Copy)] +#[derive(Debug, Clone, Copy, Hash)] pub enum GlobalInit { /// An `i32.const`. I32Const(i32), @@ -82,7 +82,7 @@ pub enum GlobalInit { } /// WebAssembly table. -#[derive(Debug, Clone, Copy)] +#[derive(Debug, Clone, Copy, Hash)] pub struct Table { /// The type of data stored in elements of the table. pub ty: TableElementType, @@ -93,7 +93,7 @@ pub struct Table { } /// WebAssembly table element. Can be a function or a scalar type. -#[derive(Debug, Clone, Copy)] +#[derive(Debug, Clone, Copy, Hash)] pub enum TableElementType { /// A scalar type. Val(ir::Type), @@ -102,7 +102,7 @@ pub enum TableElementType { } /// WebAssembly linear memory. -#[derive(Debug, Clone, Copy)] +#[derive(Debug, Clone, Copy, Hash)] pub struct Memory { /// The minimum number of pages in the memory. pub minimum: u32,