summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Hodge <tpg@ucc.asn.au>2019-03-03 19:33:29 +0800
committerJohn Hodge <tpg@ucc.asn.au>2019-03-03 19:33:29 +0800
commit9e803f50b3bf0357665626fe59ea6160772b7da4 (patch)
tree303ea78af53085322dbaecd4b460e71ec4b159cf
parentcf70b8c572509244b2b62d68a6f19aecff3cdc47 (diff)
downloadmrust-9e803f50b3bf0357665626fe59ea6160772b7da4.tar.gz
Target - Return zero/infinite for extern type align/size
-rw-r--r--src/trans/target.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/trans/target.cpp b/src/trans/target.cpp
index 6a65be15..141f5b78 100644
--- a/src/trans/target.cpp
+++ b/src/trans/target.cpp
@@ -589,6 +589,13 @@ bool Target_GetSizeAndAlignOf(const Span& sp, const StaticTraitResolve& resolve,
(Path,
if( te.binding.is_Opaque() )
return false;
+ if( te.binding.is_ExternType() )
+ {
+ DEBUG("sizeof on extern type - unsized");
+ out_align = 0;
+ out_size = SIZE_MAX;
+ return true;
+ }
const auto* repr = Target_GetTypeRepr(sp, resolve, ty);
if( !repr )
{
@@ -1158,6 +1165,11 @@ namespace {
{
return make_type_repr_enum(sp, resolve, ty);
}
+ else if( TU_TEST1(ty.m_data, Path, .binding.is_ExternType()) )
+ {
+ // TODO: Do extern types need anything?
+ return nullptr;
+ }
else if( ty.m_data.is_Primitive() )
{
return nullptr;