remove Boxed

This commit is contained in:
Folkert 2021-07-14 15:33:50 +02:00
parent 56d4ac190e
commit 0171fd0959
10 changed files with 41 additions and 67 deletions

View file

@ -44,8 +44,6 @@ pub enum Layout<'a> {
Union(UnionLayout<'a>),
RecursivePointer,
Boxed(&'a Layout<'a>),
/// A function. The types of its arguments, then the type of its return value.
Closure(&'a [Layout<'a>], LambdaSet<'a>, &'a Layout<'a>),
}
@ -599,7 +597,6 @@ impl<'a> Layout<'a> {
// We cannot memcpy pointers, because then we would have the same pointer in multiple places!
false
}
Boxed(_) => false,
}
}
@ -651,7 +648,6 @@ impl<'a> Layout<'a> {
}
Closure(_, lambda_set, _) => lambda_set.stack_size(pointer_size),
RecursivePointer => pointer_size,
Boxed(_) => pointer_size,
}
}
@ -682,7 +678,6 @@ impl<'a> Layout<'a> {
}
Layout::Builtin(builtin) => builtin.alignment_bytes(pointer_size),
Layout::RecursivePointer => pointer_size,
Layout::Boxed(_) => pointer_size,
Layout::Closure(_, captured, _) => {
pointer_size.max(captured.alignment_bytes(pointer_size))
}
@ -704,7 +699,6 @@ impl<'a> Layout<'a> {
}
RecursivePointer => true,
Boxed(_) => true,
Builtin(List(_)) | Builtin(Str) => true,
@ -738,11 +732,6 @@ impl<'a> Layout<'a> {
}
RecursivePointer => true,
Boxed(_) => {
// technically we should look at layout of the box's content
// but refcount insertion needs this to return true
true
}
Closure(_, closure_layout, _) => closure_layout.contains_refcounted(),
}
}
@ -767,7 +756,6 @@ impl<'a> Layout<'a> {
}
Union(union_layout) => union_layout.to_doc(alloc, parens),
RecursivePointer => alloc.text("*self"),
Boxed(_) => alloc.text("unbox"),
Closure(args, closure_layout, result) => {
let args_doc = args.iter().map(|x| x.to_doc(alloc, Parens::InFunction));