1
Fork 0

Unreserve braced enum variants in value namespace

This commit is contained in:
Vadim Petrochenkov 2022-10-25 20:15:15 +04:00
parent 1cbc45942d
commit 7a5376d23c
71 changed files with 364 additions and 642 deletions

View file

@ -118,8 +118,8 @@ impl<'a, 'b> visit::Visitor<'a> for DefCollector<'a, 'b> {
match i.kind {
ItemKind::Struct(ref struct_def, _) | ItemKind::Union(ref struct_def, _) => {
// If this is a unit or tuple-like struct, register the constructor.
if let Some(ctor_hir_id) = struct_def.ctor_id() {
this.create_def(ctor_hir_id, DefPathData::Ctor, i.span);
if let Some(ctor_node_id) = struct_def.ctor_node_id() {
this.create_def(ctor_node_id, DefPathData::Ctor, i.span);
}
}
_ => {}
@ -196,8 +196,8 @@ impl<'a, 'b> visit::Visitor<'a> for DefCollector<'a, 'b> {
}
let def = self.create_def(v.id, DefPathData::TypeNs(v.ident.name), v.span);
self.with_parent(def, |this| {
if let Some(ctor_hir_id) = v.data.ctor_id() {
this.create_def(ctor_hir_id, DefPathData::Ctor, v.span);
if let Some(ctor_node_id) = v.data.ctor_node_id() {
this.create_def(ctor_node_id, DefPathData::Ctor, v.span);
}
visit::walk_variant(this, v)
});