Permit uninhabited enums to cast into ints
This essentially reverts part of #6204.
This commit is contained in:
parent
e88e908e66
commit
e023158145
3 changed files with 6 additions and 11 deletions
|
@ -2481,8 +2481,10 @@ impl<'tcx> AdtDef {
|
|||
self.variants.iter().flat_map(|v| v.fields.iter())
|
||||
}
|
||||
|
||||
/// Whether the ADT lacks fields. Note that this includes uninhabited enums,
|
||||
/// e.g., `enum Void {}` is considered payload free as well.
|
||||
pub fn is_payloadfree(&self) -> bool {
|
||||
!self.variants.is_empty() && self.variants.iter().all(|v| v.fields.is_empty())
|
||||
self.variants.iter().all(|v| v.fields.is_empty())
|
||||
}
|
||||
|
||||
/// Return a `VariantDef` given a variant id.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue