@@ -131,7 +131,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
131
131
let expn_id = self . cstore ( ) . expn_that_defined_untracked ( def_id, self . tcx . sess ) ;
132
132
return Some ( self . new_module (
133
133
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) ) ) ,
135
135
expn_id,
136
136
self . def_span ( def_id) ,
137
137
// FIXME: Account for `#[no_implicit_prelude]` attributes.
@@ -594,7 +594,7 @@ impl<'a, 'ra, 'tcx> BuildReducedGraphVisitor<'a, 'ra, 'tcx> {
594
594
// HACK(eddyb) unclear how good this is, but keeping `$crate`
595
595
// in `source` breaks `tests/ui/imports/import-crate-var.rs`,
596
596
// 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 {
598
598
// `crate_name` should not be interpreted as relative.
599
599
module_path. push ( Segment :: from_ident_and_id (
600
600
Ident { name : kw:: PathRoot , span : source. ident . span } ,
@@ -603,7 +603,7 @@ impl<'a, 'ra, 'tcx> BuildReducedGraphVisitor<'a, 'ra, 'tcx> {
603
603
source. ident . name = crate_name;
604
604
}
605
605
if rename. is_none ( ) {
606
- ident. name = crate_name ;
606
+ ident. name = sym :: dummy ;
607
607
}
608
608
609
609
self . r . dcx ( ) . emit_err ( errors:: CrateImported { span : item. span } ) ;
@@ -775,7 +775,7 @@ impl<'a, 'ra, 'tcx> BuildReducedGraphVisitor<'a, 'ra, 'tcx> {
775
775
ItemKind :: Mod ( .., ref mod_kind) => {
776
776
let module = self . r . new_module (
777
777
Some ( parent) ,
778
- ModuleKind :: Def ( def_kind, def_id, ident. name ) ,
778
+ ModuleKind :: Def ( def_kind, def_id, Some ( ident. name ) ) ,
779
779
expansion. to_expn_id ( ) ,
780
780
item. span ,
781
781
parent. no_implicit_prelude
@@ -811,7 +811,7 @@ impl<'a, 'ra, 'tcx> BuildReducedGraphVisitor<'a, 'ra, 'tcx> {
811
811
ItemKind :: Enum ( _, _) | ItemKind :: Trait ( ..) => {
812
812
let module = self . r . new_module (
813
813
Some ( parent) ,
814
- ModuleKind :: Def ( def_kind, def_id, ident. name ) ,
814
+ ModuleKind :: Def ( def_kind, def_id, Some ( ident. name ) ) ,
815
815
expansion. to_expn_id ( ) ,
816
816
item. span ,
817
817
parent. no_implicit_prelude ,
0 commit comments