Unreserve braced enum variants in value namespace
This commit is contained in:
parent
1cbc45942d
commit
7a5376d23c
71 changed files with 364 additions and 642 deletions
|
@ -230,7 +230,7 @@ impl AdtDefData {
|
|||
AdtKind::Struct => AdtFlags::IS_STRUCT,
|
||||
};
|
||||
|
||||
if kind == AdtKind::Struct && variants[VariantIdx::new(0)].ctor_def_id.is_some() {
|
||||
if kind == AdtKind::Struct && variants[VariantIdx::new(0)].ctor.is_some() {
|
||||
flags |= AdtFlags::HAS_CTOR;
|
||||
}
|
||||
|
||||
|
@ -386,11 +386,9 @@ impl<'tcx> AdtDef<'tcx> {
|
|||
// Baz = 3,
|
||||
// }
|
||||
// ```
|
||||
if self
|
||||
.variants()
|
||||
.iter()
|
||||
.any(|v| matches!(v.discr, VariantDiscr::Explicit(_)) && v.ctor_kind != CtorKind::Const)
|
||||
{
|
||||
if self.variants().iter().any(|v| {
|
||||
matches!(v.discr, VariantDiscr::Explicit(_)) && v.ctor_kind() != Some(CtorKind::Const)
|
||||
}) {
|
||||
return false;
|
||||
}
|
||||
self.variants().iter().all(|v| v.fields.is_empty())
|
||||
|
@ -405,7 +403,7 @@ impl<'tcx> AdtDef<'tcx> {
|
|||
pub fn variant_with_ctor_id(self, cid: DefId) -> &'tcx VariantDef {
|
||||
self.variants()
|
||||
.iter()
|
||||
.find(|v| v.ctor_def_id == Some(cid))
|
||||
.find(|v| v.ctor_def_id() == Some(cid))
|
||||
.expect("variant_with_ctor_id: unknown variant")
|
||||
}
|
||||
|
||||
|
@ -422,7 +420,7 @@ impl<'tcx> AdtDef<'tcx> {
|
|||
pub fn variant_index_with_ctor_id(self, cid: DefId) -> VariantIdx {
|
||||
self.variants()
|
||||
.iter_enumerated()
|
||||
.find(|(_, v)| v.ctor_def_id == Some(cid))
|
||||
.find(|(_, v)| v.ctor_def_id() == Some(cid))
|
||||
.expect("variant_index_with_ctor_id: unknown variant")
|
||||
.0
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue