@@ -152,7 +152,11 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
152152 let expn_id = self . cstore ( ) . expn_that_defined_untracked ( def_id, self . tcx . sess ) ;
153153 return Some ( self . new_extern_module (
154154 parent,
155- ModuleKind :: Def ( def_kind, def_id, Some ( self . tcx . item_name ( def_id) ) ) ,
155+ ModuleKind :: Def (
156+ def_kind,
157+ def_id,
158+ Some ( ( self . tcx . item_name ( def_id) , false ) ) ,
159+ ) ,
156160 expn_id,
157161 self . def_span ( def_id) ,
158162 // FIXME: Account for `#[no_implicit_prelude]` attributes.
@@ -630,14 +634,14 @@ impl<'a, 'ra, 'tcx> BuildReducedGraphVisitor<'a, 'ra, 'tcx> {
630634 // Disallow `use $crate;`
631635 if source. ident . name == kw:: DollarCrate && module_path. is_empty ( ) {
632636 let crate_root = self . r . resolve_crate_root ( source. ident ) ;
633- let crate_name = match crate_root. kind {
634- ModuleKind :: Def ( .., name ) => name ,
637+ let crate_name_and_transparent = match crate_root. kind {
638+ ModuleKind :: Def ( .., name_and_transparent ) => name_and_transparent ,
635639 ModuleKind :: Block => unreachable ! ( ) ,
636640 } ;
637641 // HACK(eddyb) unclear how good this is, but keeping `$crate`
638642 // in `source` breaks `tests/ui/imports/import-crate-var.rs`,
639643 // while the current crate doesn't have a valid `crate_name`.
640- if let Some ( crate_name) = crate_name {
644+ if let Some ( ( crate_name, _transparent ) ) = crate_name_and_transparent {
641645 // `crate_name` should not be interpreted as relative.
642646 module_path. push ( Segment :: from_ident_and_id (
643647 Ident :: new ( kw:: PathRoot , source. ident . span ) ,
@@ -819,9 +823,18 @@ impl<'a, 'ra, 'tcx> BuildReducedGraphVisitor<'a, 'ra, 'tcx> {
819823 {
820824 self . r . mods_with_parse_errors . insert ( def_id) ;
821825 }
826+ let transparent = AttributeParser :: parse_limited (
827+ self . r . tcx . sess ,
828+ & item. attrs ,
829+ sym:: transparent,
830+ item. span ,
831+ item. id ,
832+ None ,
833+ )
834+ . is_some ( ) ;
822835 self . parent_scope . module = self . r . new_local_module (
823836 Some ( parent) ,
824- ModuleKind :: Def ( def_kind, def_id, Some ( ident. name ) ) ,
837+ ModuleKind :: Def ( def_kind, def_id, Some ( ( ident. name , transparent ) ) ) ,
825838 expansion. to_expn_id ( ) ,
826839 item. span ,
827840 parent. no_implicit_prelude
@@ -854,7 +867,7 @@ impl<'a, 'ra, 'tcx> BuildReducedGraphVisitor<'a, 'ra, 'tcx> {
854867
855868 self . parent_scope . module = self . r . new_local_module (
856869 Some ( parent) ,
857- ModuleKind :: Def ( def_kind, def_id, Some ( ident. name ) ) ,
870+ ModuleKind :: Def ( def_kind, def_id, Some ( ( ident. name , false ) ) ) ,
858871 expansion. to_expn_id ( ) ,
859872 item. span ,
860873 parent. no_implicit_prelude ,
0 commit comments