@@ -164,7 +164,11 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
164164 let expn_id = self . cstore ( ) . expn_that_defined_untracked ( self . tcx , def_id) ;
165165 return Some ( self . new_extern_module (
166166 parent,
167- ModuleKind :: Def ( def_kind, def_id, Some ( self . tcx . item_name ( def_id) ) ) ,
167+ ModuleKind :: Def (
168+ def_kind,
169+ def_id,
170+ Some ( ( self . tcx . item_name ( def_id) , false ) ) ,
171+ ) ,
168172 expn_id,
169173 self . def_span ( def_id) ,
170174 // FIXME: Account for `#[no_implicit_prelude]` attributes.
@@ -664,14 +668,14 @@ impl<'a, 'ra, 'tcx> BuildReducedGraphVisitor<'a, 'ra, 'tcx> {
664668 // Disallow `use $crate;`
665669 if source. ident . name == kw:: DollarCrate && module_path. is_empty ( ) {
666670 let crate_root = self . r . resolve_crate_root ( source. ident ) ;
667- let crate_name = match crate_root. kind {
668- ModuleKind :: Def ( .., name ) => name ,
671+ let crate_name_and_transparent = match crate_root. kind {
672+ ModuleKind :: Def ( .., name_and_transparent ) => name_and_transparent ,
669673 ModuleKind :: Block => unreachable ! ( ) ,
670674 } ;
671675 // HACK(eddyb) unclear how good this is, but keeping `$crate`
672676 // in `source` breaks `tests/ui/imports/import-crate-var.rs`,
673677 // while the current crate doesn't have a valid `crate_name`.
674- if let Some ( crate_name) = crate_name {
678+ if let Some ( ( crate_name, _transparent ) ) = crate_name_and_transparent {
675679 // `crate_name` should not be interpreted as relative.
676680 module_path. push ( Segment :: from_ident_and_id (
677681 Ident :: new ( kw:: PathRoot , source. ident . span ) ,
@@ -853,9 +857,18 @@ impl<'a, 'ra, 'tcx> BuildReducedGraphVisitor<'a, 'ra, 'tcx> {
853857 {
854858 self . r . mods_with_parse_errors . insert ( def_id) ;
855859 }
860+ let transparent = AttributeParser :: parse_limited (
861+ self . r . tcx . sess ,
862+ & item. attrs ,
863+ sym:: transparent,
864+ item. span ,
865+ item. id ,
866+ None ,
867+ )
868+ . is_some ( ) ;
856869 self . parent_scope . module = self . r . new_local_module (
857870 Some ( parent) ,
858- ModuleKind :: Def ( def_kind, def_id, Some ( ident. name ) ) ,
871+ ModuleKind :: Def ( def_kind, def_id, Some ( ( ident. name , transparent ) ) ) ,
859872 expansion. to_expn_id ( ) ,
860873 item. span ,
861874 parent. no_implicit_prelude
@@ -888,7 +901,7 @@ impl<'a, 'ra, 'tcx> BuildReducedGraphVisitor<'a, 'ra, 'tcx> {
888901
889902 self . parent_scope . module = self . r . new_local_module (
890903 Some ( parent) ,
891- ModuleKind :: Def ( def_kind, def_id, Some ( ident. name ) ) ,
904+ ModuleKind :: Def ( def_kind, def_id, Some ( ( ident. name , false ) ) ) ,
892905 expansion. to_expn_id ( ) ,
893906 item. span ,
894907 parent. no_implicit_prelude ,
0 commit comments