There is multiple places in shame where type layouts are checked and compared. It would be nice to merge these checks/comparisons as much as possible to reduce maintenance burden.
After #19 and #21 mainly
src/frontend/any/rust_types/type_layout/construction.rs
src/frontend/any/rust_types/type_layout/eq.rs
contain these checks and comparisons.
Suggested approach
Integrate check_repr_equivalence_for_type of construction.rs into check_eq of eq.rs by passing an EqContext enum, which describes in what kind of setting we are comparing the two type layouts. check_eq can keep it's simple type_layout1 == type_layout2 check and in case of a mismatch EqContext is passed to the LayoutMismatch error, which handles figuring out where exactly the mismatch occured and generates an error message appropriate for the EqContext.
There is multiple places in shame where type layouts are checked and compared. It would be nice to merge these checks/comparisons as much as possible to reduce maintenance burden.
After #19 and #21 mainly
src/frontend/any/rust_types/type_layout/construction.rssrc/frontend/any/rust_types/type_layout/eq.rscontain these checks and comparisons.
Suggested approach
Integrate
check_repr_equivalence_for_typeofconstruction.rsintocheck_eqofeq.rsby passing anEqContextenum, which describes in what kind of setting we are comparing the two type layouts.check_eqcan keep it's simpletype_layout1 == type_layout2check and in case of a mismatchEqContextis passed to theLayoutMismatcherror, which handles figuring out where exactly the mismatch occured and generates an error message appropriate for theEqContext.