We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f646c1e commit c01c494Copy full SHA for c01c494
compiler/rustc_mir/src/const_eval/mod.rs
@@ -69,10 +69,11 @@ fn const_to_valtree_inner<'tcx>(
69
let field = ecx.mplace_field(&place, i).unwrap();
70
const_to_valtree_inner(ecx, &field)
71
});
72
+ // For enums, we preped their variant index before the variant's fields so we can figure out
73
+ // the variant again when just seeing a valtree.
74
+ let branches = variant.into_iter().chain(fields);
75
Some(ty::ValTree::Branch(
- ecx.tcx
- .arena
- .alloc_from_iter(variant.into_iter().chain(fields).collect::<Option<Vec<_>>>()?),
76
+ ecx.tcx.arena.alloc_from_iter(branches.collect::<Option<Vec<_>>>()?),
77
))
78
};
79
match place.layout.ty.kind() {
0 commit comments