Fix ICE and type mismatch with array type aliases and const generics#7638
Fix ICE and type mismatch with array type aliases and const generics#7638Dnreikronos wants to merge 3 commits into
Conversation
extract_type_parameters ignored array lengths when matching concrete arrays against generic impls like [T; N], so N was never mapped to its literal value. Additionally, MaterializeConstGenerics did not recurse through TypeInfo::Alias, stopping materialization at the alias boundary. Closes FuelLabs#7616
Covers struct fields typed as array aliases, nested aliases, equality via the Eq trait, and Vec<Alias>::get().unwrap() return type resolution.
|
Thanks for the contribution! Before we can merge this, we need @Dnreikronos to sign the Fuel Labs Contributor License Agreement. |
PR SummaryMedium Risk Overview
Adds e2e Reviewed by Cursor Bugbot for commit 828f7ea. Bugbot is set up for automated code reviews on this repo. Configure here. |
Summary
type ArrayU8Len2 = [u8; 2]) are used as struct fields and compared via==extract_type_parametersnow extracts const generic length parameters from array types (e.g.N → 2), matching the existing pattern used for Enum/Struct const genericsMaterializeConstGenerics for TypeIdnow handlesTypeInfo::Aliasby recursing into the aliased type, consistent with the existingRefhandlingTest plan
type_alias_array_const_genericscovering:[ArrayU8Len2; 3])Eqtrait const generic pathVec<Alias>::get().unwrap()return type resolutiontype_alias*tests pass (11/11)const_generic*tests pass (3/3)array*tests pass (18/18)Closes #7616