fix comment

This commit is contained in:
Folkert 2021-06-21 23:28:38 +02:00
parent e80f8a5114
commit 6890193917

View file

@ -1423,14 +1423,8 @@ pub fn build_exp_expr<'a, 'ctx, 'env>(
Reuse { .. } => todo!(), Reuse { .. } => todo!(),
StructAtIndex { StructAtIndex {
index, index, structure, ..
structure,
field_layouts,
} => { } => {
// if you hit this: we unwrap 1-element records, so instead of `x = StructAtIndex 0 y`
// you should substitute `x` with `y` in the remainder of the statement
debug_assert!(field_layouts.len() > 1, "one-element records are unwrapped");
// extract field from a record // extract field from a record
match load_symbol_and_layout(scope, structure) { match load_symbol_and_layout(scope, structure) {
(StructValue(argument), Layout::Struct(fields)) => { (StructValue(argument), Layout::Struct(fields)) => {
@ -1479,10 +1473,13 @@ pub fn build_exp_expr<'a, 'ctx, 'env>(
env.builder.build_load(ptr, "load_rosetree_like") env.builder.build_load(ptr, "load_rosetree_like")
} }
(other, layout) => unreachable!( (other, layout) => {
"can only index into struct layout\nValue: {:?}\nLayout: {:?}\nIndex: {:?}", // potential cause: indexing into an unwrapped 1-element record/tag?
other, layout, index unreachable!(
), "can only index into struct layout\nValue: {:?}\nLayout: {:?}\nIndex: {:?}",
other, layout, index
)
}
} }
} }