Skip to content

Commit

Permalink
layout: give HandleDatatype the trait too
Browse files Browse the repository at this point in the history
  • Loading branch information
Pat Hickey authored and pchickey committed Dec 20, 2019
1 parent 50694f2 commit 031bbe0
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion tools/witx/src/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ impl TypeRef {
Type::Flags(f) => f.repr.mem_size_align(),
Type::Struct(s) => s.layout(cache),
Type::Union(u) => u.layout(cache),
Type::Handle { .. } => BuiltinType::U32.mem_size_align(),
Type::Handle(h) => h.mem_size_align(),
Type::Array { .. } => BuiltinType::String.mem_size_align(),
Type::Pointer { .. } | Type::ConstPointer { .. } => BuiltinType::U32.mem_size_align(),
Type::Builtin(b) => b.mem_size_align(),
Expand Down Expand Up @@ -159,6 +159,12 @@ impl Layout for UnionDatatype {
}
}

impl Layout for HandleDatatype {
fn mem_size_align(&self) -> SizeAlign {
BuiltinType::U32.mem_size_align()
}
}

impl Layout for BuiltinType {
fn mem_size_align(&self) -> SizeAlign {
match self {
Expand Down

0 comments on commit 031bbe0

Please sign in to comment.