Use runtime representation of values when building structural eq

Closes #4348
This commit is contained in:
Ayaz Hafiz 2022-10-17 11:36:06 -05:00
parent 99ad019d75
commit 7986514d20
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
2 changed files with 20 additions and 0 deletions

View file

@ -147,6 +147,8 @@ fn build_eq<'a, 'ctx, 'env>(
rhs_layout: &Layout<'a>,
when_recursive: WhenRecursive<'a>,
) -> BasicValueEnum<'ctx> {
let lhs_layout = &lhs_layout.runtime_representation(env.layout_interner);
let rhs_layout = &rhs_layout.runtime_representation(env.layout_interner);
if lhs_layout != rhs_layout {
panic!(
"Equality of different layouts; did you have a type mismatch?\n{:?} == {:?}",