mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-27 13:59:08 +00:00
Remove dead code
This commit is contained in:
parent
58a28bb7b8
commit
1aa89fc567
1 changed files with 0 additions and 35 deletions
|
@ -2351,41 +2351,6 @@ impl<'a> Layout<'a> {
|
||||||
false // TODO this should use is_zero_sized once doing so doesn't break things!
|
false // TODO this should use is_zero_sized once doing so doesn't break things!
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Like stack_size, but doesn't require target info because
|
|
||||||
/// whether something is zero sized is not target-dependent.
|
|
||||||
#[allow(dead_code)]
|
|
||||||
fn is_zero_sized(&self) -> bool {
|
|
||||||
match self {
|
|
||||||
// There are no zero-sized builtins
|
|
||||||
Layout::Builtin(_) => false,
|
|
||||||
// Functions are never zero-sized
|
|
||||||
Layout::LambdaSet(_) => false,
|
|
||||||
// Empty structs, or structs with all zero-sized fields, are zero-sized
|
|
||||||
Layout::Struct { field_layouts, .. } => field_layouts.iter().all(Self::is_zero_sized),
|
|
||||||
// A Box that points to nothing should be unwrapped
|
|
||||||
Layout::Boxed(content) => content.is_zero_sized(),
|
|
||||||
Layout::Union(union_layout) => match union_layout {
|
|
||||||
UnionLayout::NonRecursive(tags)
|
|
||||||
| UnionLayout::Recursive(tags)
|
|
||||||
| UnionLayout::NullableWrapped {
|
|
||||||
other_tags: tags, ..
|
|
||||||
} => tags
|
|
||||||
.iter()
|
|
||||||
.all(|payloads| payloads.iter().all(Self::is_zero_sized)),
|
|
||||||
UnionLayout::NonNullableUnwrapped(tags)
|
|
||||||
| UnionLayout::NullableUnwrapped {
|
|
||||||
other_fields: tags, ..
|
|
||||||
} => tags.iter().all(Self::is_zero_sized),
|
|
||||||
},
|
|
||||||
// Recursive pointers are considered zero-sized because
|
|
||||||
// if you have a recursive data structure where everything
|
|
||||||
// else but the recutsive pointer is zero-sized, then
|
|
||||||
// the whole thing is unnecessary at runtime and should
|
|
||||||
// be zero-sized.
|
|
||||||
Layout::RecursivePointer => true,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn is_passed_by_reference<I>(&self, interner: &I, target_info: TargetInfo) -> bool
|
pub fn is_passed_by_reference<I>(&self, interner: &I, target_info: TargetInfo) -> bool
|
||||||
where
|
where
|
||||||
I: Interner<'a, Layout<'a>>,
|
I: Interner<'a, Layout<'a>>,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue