mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-27 22:09:09 +00:00
alignment in single element tag unions
This commit is contained in:
parent
1e4f0e8b07
commit
ccd2e0ecf4
5 changed files with 66 additions and 7 deletions
|
@ -1047,6 +1047,15 @@ pub fn union_sorted_tags_help<'a>(
|
|||
}
|
||||
}
|
||||
|
||||
layouts.sort_by(|layout1, layout2| {
|
||||
let ptr_bytes = 8;
|
||||
|
||||
let size1 = layout1.alignment_bytes(ptr_bytes);
|
||||
let size2 = layout2.alignment_bytes(ptr_bytes);
|
||||
|
||||
size2.cmp(&size1)
|
||||
});
|
||||
|
||||
if layouts.is_empty() {
|
||||
if contains_zero_sized {
|
||||
UnionVariant::UnitWithArguments
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue