@@ -165,7 +165,11 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
165165 let expn_id = self . cstore ( ) . expn_that_defined_untracked ( self . tcx , def_id) ;
166166 return Some ( self . new_extern_module (
167167 parent,
168- ModuleKind :: Def ( def_kind, def_id, Some ( self . tcx . item_name ( def_id) ) ) ,
168+ ModuleKind :: Def (
169+ def_kind,
170+ def_id,
171+ Some ( ( self . tcx . item_name ( def_id) , false ) ) ,
172+ ) ,
169173 expn_id,
170174 self . def_span ( def_id) ,
171175 // FIXME: Account for `#[no_implicit_prelude]` attributes.
@@ -666,14 +670,14 @@ impl<'a, 'ra, 'tcx> BuildReducedGraphVisitor<'a, 'ra, 'tcx> {
666670 // Disallow `use $crate;`
667671 if source. ident . name == kw:: DollarCrate && module_path. is_empty ( ) {
668672 let crate_root = self . r . resolve_crate_root ( source. ident ) ;
669- let crate_name = match crate_root. kind {
670- ModuleKind :: Def ( .., name ) => name ,
673+ let crate_name_and_transparent = match crate_root. kind {
674+ ModuleKind :: Def ( .., name_and_transparent ) => name_and_transparent ,
671675 ModuleKind :: Block => unreachable ! ( ) ,
672676 } ;
673677 // HACK(eddyb) unclear how good this is, but keeping `$crate`
674678 // in `source` breaks `tests/ui/imports/import-crate-var.rs`,
675679 // while the current crate doesn't have a valid `crate_name`.
676- if let Some ( crate_name) = crate_name {
680+ if let Some ( ( crate_name, _transparent ) ) = crate_name_and_transparent {
677681 // `crate_name` should not be interpreted as relative.
678682 module_path. push ( Segment :: from_ident_and_id (
679683 Ident :: new ( kw:: PathRoot , source. ident . span ) ,
@@ -855,9 +859,18 @@ impl<'a, 'ra, 'tcx> BuildReducedGraphVisitor<'a, 'ra, 'tcx> {
855859 {
856860 self . r . mods_with_parse_errors . insert ( def_id) ;
857861 }
862+ let transparent = AttributeParser :: parse_limited (
863+ self . r . tcx . sess ,
864+ & item. attrs ,
865+ sym:: transparent,
866+ item. span ,
867+ item. id ,
868+ None ,
869+ )
870+ . is_some ( ) ;
858871 self . parent_scope . module = self . r . new_local_module (
859872 Some ( parent) ,
860- ModuleKind :: Def ( def_kind, def_id, Some ( ident. name ) ) ,
873+ ModuleKind :: Def ( def_kind, def_id, Some ( ( ident. name , transparent ) ) ) ,
861874 expansion. to_expn_id ( ) ,
862875 item. span ,
863876 parent. no_implicit_prelude
@@ -890,7 +903,7 @@ impl<'a, 'ra, 'tcx> BuildReducedGraphVisitor<'a, 'ra, 'tcx> {
890903
891904 self . parent_scope . module = self . r . new_local_module (
892905 Some ( parent) ,
893- ModuleKind :: Def ( def_kind, def_id, Some ( ident. name ) ) ,
906+ ModuleKind :: Def ( def_kind, def_id, Some ( ( ident. name , false ) ) ) ,
894907 expansion. to_expn_id ( ) ,
895908 item. span ,
896909 parent. no_implicit_prelude ,
0 commit comments