@@ -636,24 +636,24 @@ impl<'a> Resolver<'a> {
636
636
// but metadata cannot encode gensyms currently, so we create it here.
637
637
// This is only a guess, two equivalent idents may incorrectly get different gensyms here.
638
638
let ident = ident.gensym_if_underscore();
639
- let def_id = def.def_id();
640
639
let expansion = Mark::root(); // FIXME(jseyfried) intercrate hygiene
641
640
match def {
642
- Def::Mod(.. ) | Def::Enum(.. ) => {
641
+ Def::Mod(def_id ) | Def::Enum(def_id ) => {
643
642
let module = self.new_module(parent,
644
643
ModuleKind::Def(def, ident.name),
645
644
def_id,
646
645
expansion,
647
646
span);
648
647
self.define(parent, ident, TypeNS, (module, vis, DUMMY_SP, expansion));
649
648
}
650
- Def::Variant(..) | Def::TyAlias(..) | Def::ForeignTy(..) => {
649
+ Def::Variant(..) | Def::TyAlias(..) | Def::ForeignTy(..) | Def::Existential(..) |
650
+ Def::TraitAlias(..) | Def::PrimTy(..) | Def::ToolMod => {
651
651
self.define(parent, ident, TypeNS, (def, vis, DUMMY_SP, expansion));
652
652
}
653
653
Def::Fn(..) | Def::Static(..) | Def::Const(..) | Def::VariantCtor(..) => {
654
654
self.define(parent, ident, ValueNS, (def, vis, DUMMY_SP, expansion));
655
655
}
656
- Def::StructCtor(..) => {
656
+ Def::StructCtor(def_id, ..) => {
657
657
self.define(parent, ident, ValueNS, (def, vis, DUMMY_SP, expansion));
658
658
659
659
if let Some(struct_def_id) =
@@ -662,7 +662,7 @@ impl<'a> Resolver<'a> {
662
662
self.struct_constructors.insert(struct_def_id, (def, vis));
663
663
}
664
664
}
665
- Def::Trait(.. ) => {
665
+ Def::Trait(def_id ) => {
666
666
let module_kind = ModuleKind::Def(def, ident.name);
667
667
let module = self.new_module(parent,
668
668
module_kind,
@@ -683,18 +683,14 @@ impl<'a> Resolver<'a> {
683
683
}
684
684
module.populated.set(true);
685
685
}
686
- Def::Existential(..) |
687
- Def::TraitAlias(..) => {
688
- self.define(parent, ident, TypeNS, (def, vis, DUMMY_SP, expansion));
689
- }
690
- Def::Struct(..) | Def::Union(..) => {
686
+ Def::Struct(def_id) | Def::Union(def_id) => {
691
687
self.define(parent, ident, TypeNS, (def, vis, DUMMY_SP, expansion));
692
688
693
689
// Record field names for error reporting.
694
690
let field_names = self.cstore.struct_field_names_untracked(def_id);
695
691
self.insert_field_names(def_id, field_names);
696
692
}
697
- Def::Macro(..) => {
693
+ Def::Macro(..) | Def::NonMacroAttr(..) => {
698
694
self.define(parent, ident, MacroNS, (def, vis, DUMMY_SP, expansion));
699
695
}
700
696
_ => bug!("unexpected definition: {:?}", def)
0 commit comments