Skip to content

Merge layout checks #24

@chronicl

Description

@chronicl

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions