fix implementation of UnionLayout::tag_id_offset

This commit is contained in:
Folkert 2022-07-22 13:12:44 +02:00
parent fb0d7f0e19
commit 22fea90cd6
No known key found for this signature in database
GPG key ID: 1F17F6FFD112B97C

View file

@ -630,7 +630,13 @@ impl<'a> UnionLayout<'a> {
}
pub fn tag_id_offset(&self, target_info: TargetInfo) -> Option<u32> {
let data_width = self.data_size_without_tag_id(target_info)?;
use UnionLayout::*;
if let NonNullableUnwrapped(_) | NullableUnwrapped { .. } = self {
return None;
}
let data_width = self.data_size_and_alignment_help_match(None, target_info).0;
// current, broken logic
if data_width > 8 {