@@ -131,7 +131,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
131131 let expn_id = self . cstore ( ) . expn_that_defined_untracked ( def_id, self . tcx . sess ) ;
132132 return Some ( self . new_module (
133133 parent,
134- ModuleKind :: Def ( def_kind, def_id, self . tcx . item_name ( def_id) ) ,
134+ ModuleKind :: Def ( def_kind, def_id, Some ( self . tcx . item_name ( def_id) ) ) ,
135135 expn_id,
136136 self . def_span ( def_id) ,
137137 // FIXME: Account for `#[no_implicit_prelude]` attributes.
@@ -594,7 +594,7 @@ impl<'a, 'ra, 'tcx> BuildReducedGraphVisitor<'a, 'ra, 'tcx> {
594594 // HACK(eddyb) unclear how good this is, but keeping `$crate`
595595 // in `source` breaks `tests/ui/imports/import-crate-var.rs`,
596596 // while the current crate doesn't have a valid `crate_name`.
597- if crate_name != kw :: Empty {
597+ if let Some ( crate_name) = crate_name {
598598 // `crate_name` should not be interpreted as relative.
599599 module_path. push ( Segment :: from_ident_and_id (
600600 Ident { name : kw:: PathRoot , span : source. ident . span } ,
@@ -603,7 +603,7 @@ impl<'a, 'ra, 'tcx> BuildReducedGraphVisitor<'a, 'ra, 'tcx> {
603603 source. ident . name = crate_name;
604604 }
605605 if rename. is_none ( ) {
606- ident. name = crate_name ;
606+ ident. name = sym :: dummy ;
607607 }
608608
609609 self . r . dcx ( ) . emit_err ( errors:: CrateImported { span : item. span } ) ;
@@ -775,7 +775,7 @@ impl<'a, 'ra, 'tcx> BuildReducedGraphVisitor<'a, 'ra, 'tcx> {
775775 ItemKind :: Mod ( .., ref mod_kind) => {
776776 let module = self . r . new_module (
777777 Some ( parent) ,
778- ModuleKind :: Def ( def_kind, def_id, ident. name ) ,
778+ ModuleKind :: Def ( def_kind, def_id, Some ( ident. name ) ) ,
779779 expansion. to_expn_id ( ) ,
780780 item. span ,
781781 parent. no_implicit_prelude
@@ -811,7 +811,7 @@ impl<'a, 'ra, 'tcx> BuildReducedGraphVisitor<'a, 'ra, 'tcx> {
811811 ItemKind :: Enum ( _, _) | ItemKind :: Trait ( ..) => {
812812 let module = self . r . new_module (
813813 Some ( parent) ,
814- ModuleKind :: Def ( def_kind, def_id, ident. name ) ,
814+ ModuleKind :: Def ( def_kind, def_id, Some ( ident. name ) ) ,
815815 expansion. to_expn_id ( ) ,
816816 item. span ,
817817 parent. no_implicit_prelude ,
0 commit comments