ariesdevil commented on code in PR #3080:
URL: https://github.com/apache/fory/pull/3080#discussion_r2644692327
##########
rust/fory-core/src/types.rs:
##########
@@ -84,19 +84,29 @@ pub enum TypeId {
U8 = 64,
U16 = 65,
U32 = 66,
- U64 = 67,
- USIZE = 68,
- U128 = 69,
- VAR_U32 = 70,
- VAR_U64 = 71,
- SLI_U64 = 72,
- U16_ARRAY = 73,
- U32_ARRAY = 74,
- U64_ARRAY = 75,
- USIZE_ARRAY = 76,
- U128_ARRAY = 77,
+ VAR_U32 = 67,
+ U64 = 68,
+ VAR_U64 = 69,
+ SLI_U64 = 70,
+ U128 = 71,
+ INT128 = 72,
+ // USIZE/ISIZE must have their own TypeId.
+ // Although usize and u64 have the same size on 64-bit systems, they are
+ // different Rust types.
+ // When deserializing `Box<dyn Any>`, we need to create the exact type.
+ // If we used U64's TypeId for usize, deserialization would create a u64
value,
+ // and `result.downcast_ref::<usize>()` would return None.
+ USIZE = 73,
+ ISIZE = 74,
+ U16_ARRAY = 75,
+ U32_ARRAY = 76,
+ U64_ARRAY = 77,
+ U128_ARRAY = 78,
+ INT128_ARRAY = 79,
Review Comment:
Same reason as above
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]