提交 f8f80334 编写于 作者: R Ralf Jung

assert that types without discriminant use variant idx of 0

上级 5a3971cd
......@@ -596,7 +596,8 @@ pub fn read_discriminant(
Scalar::from_uint(discr.val, discr_layout.size)
}
None => {
// On a type without actual discriminants, return variant idx as `u8`.
// On a type without actual discriminants, variant is 0. Return variant idx as `u8`.
assert_eq!(index.as_u32(), 0);
let discr_layout = self.layout_of(self.tcx.types.u8)?;
Scalar::from_uint(index.as_u32(), discr_layout.size)
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册