@@ -534,7 +534,7 @@ pub enum ComponentValType {
534
534
535
535
impl TypeData for ComponentValType {
536
536
type Id = ComponentValueTypeId ;
537
-
537
+ const IS_CORE_SUB_TYPE : bool = false ;
538
538
fn type_info ( & self , types : & TypeList ) -> TypeInfo {
539
539
match self {
540
540
ComponentValType :: Primitive ( _) => TypeInfo :: new ( ) ,
@@ -641,7 +641,7 @@ pub struct ModuleType {
641
641
642
642
impl TypeData for ModuleType {
643
643
type Id = ComponentCoreModuleTypeId ;
644
-
644
+ const IS_CORE_SUB_TYPE : bool = false ;
645
645
fn type_info ( & self , _types : & TypeList ) -> TypeInfo {
646
646
self . info
647
647
}
@@ -677,7 +677,7 @@ pub struct InstanceType {
677
677
678
678
impl TypeData for InstanceType {
679
679
type Id = ComponentCoreInstanceTypeId ;
680
-
680
+ const IS_CORE_SUB_TYPE : bool = false ;
681
681
fn type_info ( & self , _types : & TypeList ) -> TypeInfo {
682
682
self . info
683
683
}
@@ -817,7 +817,7 @@ pub struct ComponentType {
817
817
818
818
impl TypeData for ComponentType {
819
819
type Id = ComponentTypeId ;
820
-
820
+ const IS_CORE_SUB_TYPE : bool = false ;
821
821
fn type_info ( & self , _types : & TypeList ) -> TypeInfo {
822
822
self . info
823
823
}
@@ -875,7 +875,7 @@ pub struct ComponentInstanceType {
875
875
876
876
impl TypeData for ComponentInstanceType {
877
877
type Id = ComponentInstanceTypeId ;
878
-
878
+ const IS_CORE_SUB_TYPE : bool = false ;
879
879
fn type_info ( & self , _types : & TypeList ) -> TypeInfo {
880
880
self . info
881
881
}
@@ -894,7 +894,7 @@ pub struct ComponentFuncType {
894
894
895
895
impl TypeData for ComponentFuncType {
896
896
type Id = ComponentFuncTypeId ;
897
-
897
+ const IS_CORE_SUB_TYPE : bool = false ;
898
898
fn type_info ( & self , _types : & TypeList ) -> TypeInfo {
899
899
self . info
900
900
}
@@ -1080,7 +1080,7 @@ pub enum ComponentDefinedType {
1080
1080
1081
1081
impl TypeData for ComponentDefinedType {
1082
1082
type Id = ComponentDefinedTypeId ;
1083
-
1083
+ const IS_CORE_SUB_TYPE : bool = false ;
1084
1084
fn type_info ( & self , types : & TypeList ) -> TypeInfo {
1085
1085
match self {
1086
1086
Self :: Primitive ( _)
@@ -3364,6 +3364,10 @@ impl Remap for SubtypeArena<'_> {
3364
3364
where
3365
3365
T : TypeData ,
3366
3366
{
3367
+ assert ! (
3368
+ !T :: IS_CORE_SUB_TYPE ,
3369
+ "cannot push core sub types into `SubtypeArena`s, that would break type canonicalization"
3370
+ ) ;
3367
3371
let index = T :: Id :: list ( & self . list ) . len ( ) + T :: Id :: list ( self . types ) . len ( ) ;
3368
3372
let index = u32:: try_from ( index) . unwrap ( ) ;
3369
3373
self . list . push ( ty) ;
0 commit comments