'fieldless enums' is not what I meant -- it's empty/uninhabited enums, really
This commit is contained in:
parent
96bb8b31c8
commit
6548be2ba9
2 changed files with 2 additions and 3 deletions
|
@ -579,13 +579,12 @@ impl<'rt, 'mir, 'tcx, M: Machine<'mir, 'tcx>> ValueVisitor<'mir, 'tcx, M>
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check primitive types. We do this after checking for uninhabited types,
|
// Check primitive types. We do this after checking for uninhabited types,
|
||||||
// to exclude fieldless enums (that also appear as fieldless unions here).
|
// to exclude uninhabited enums (that also appear as fieldless unions here).
|
||||||
// Primitives can have varying layout, so we check them separately and before aggregate
|
// Primitives can have varying layout, so we check them separately and before aggregate
|
||||||
// handling.
|
// handling.
|
||||||
// It is CRITICAL that we get this check right, or we might be validating the wrong thing!
|
// It is CRITICAL that we get this check right, or we might be validating the wrong thing!
|
||||||
let primitive = match op.layout.fields {
|
let primitive = match op.layout.fields {
|
||||||
// Primitives appear as Union with 0 fields - except for Boxes and fat pointers.
|
// Primitives appear as Union with 0 fields - except for Boxes and fat pointers.
|
||||||
// (Fieldless enums also appear here, but they are uninhabited and thus handled above.)
|
|
||||||
layout::FieldPlacement::Union(0) => true,
|
layout::FieldPlacement::Union(0) => true,
|
||||||
_ => op.layout.ty.builtin_deref(true).is_some(),
|
_ => op.layout.ty.builtin_deref(true).is_some(),
|
||||||
};
|
};
|
||||||
|
|
|
@ -872,7 +872,7 @@ impl Niche {
|
||||||
#[derive(PartialEq, Eq, Hash, Debug, HashStable_Generic)]
|
#[derive(PartialEq, Eq, Hash, Debug, HashStable_Generic)]
|
||||||
pub struct LayoutDetails {
|
pub struct LayoutDetails {
|
||||||
/// Says where the fields are located within the layout.
|
/// Says where the fields are located within the layout.
|
||||||
/// Primitives and fieldless enums appear as unions without fields.
|
/// Primitives and uninhabited enums appear as unions without fields.
|
||||||
pub fields: FieldPlacement,
|
pub fields: FieldPlacement,
|
||||||
|
|
||||||
/// Encodes information about multi-variant layouts.
|
/// Encodes information about multi-variant layouts.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue