@@ -154,7 +154,11 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
154154 let expn_id = self . cstore ( ) . expn_that_defined_untracked ( def_id, self . tcx . sess ) ;
155155 return Some ( self . new_extern_module (
156156 parent,
157- ModuleKind :: Def ( def_kind, def_id, Some ( self . tcx . item_name ( def_id) ) ) ,
157+ ModuleKind :: Def (
158+ def_kind,
159+ def_id,
160+ Some ( ( self . tcx . item_name ( def_id) , false ) ) ,
161+ ) ,
158162 expn_id,
159163 self . def_span ( def_id) ,
160164 // FIXME: Account for `#[no_implicit_prelude]` attributes.
@@ -629,14 +633,14 @@ impl<'a, 'ra, 'tcx> BuildReducedGraphVisitor<'a, 'ra, 'tcx> {
629633 // Disallow `use $crate;`
630634 if source. ident . name == kw:: DollarCrate && module_path. is_empty ( ) {
631635 let crate_root = self . r . resolve_crate_root ( source. ident ) ;
632- let crate_name = match crate_root. kind {
633- ModuleKind :: Def ( .., name ) => name ,
636+ let crate_name_and_transparent = match crate_root. kind {
637+ ModuleKind :: Def ( .., name_and_transparent ) => name_and_transparent ,
634638 ModuleKind :: Block => unreachable ! ( ) ,
635639 } ;
636640 // HACK(eddyb) unclear how good this is, but keeping `$crate`
637641 // in `source` breaks `tests/ui/imports/import-crate-var.rs`,
638642 // while the current crate doesn't have a valid `crate_name`.
639- if let Some ( crate_name) = crate_name {
643+ if let Some ( ( crate_name, _transparent ) ) = crate_name_and_transparent {
640644 // `crate_name` should not be interpreted as relative.
641645 module_path. push ( Segment :: from_ident_and_id (
642646 Ident :: new ( kw:: PathRoot , source. ident . span ) ,
@@ -818,9 +822,18 @@ impl<'a, 'ra, 'tcx> BuildReducedGraphVisitor<'a, 'ra, 'tcx> {
818822 {
819823 self . r . mods_with_parse_errors . insert ( def_id) ;
820824 }
825+ let transparent = AttributeParser :: parse_limited (
826+ self . r . tcx . sess ,
827+ & item. attrs ,
828+ sym:: transparent,
829+ item. span ,
830+ item. id ,
831+ None ,
832+ )
833+ . is_some ( ) ;
821834 self . parent_scope . module = self . r . new_local_module (
822835 Some ( parent) ,
823- ModuleKind :: Def ( def_kind, def_id, Some ( ident. name ) ) ,
836+ ModuleKind :: Def ( def_kind, def_id, Some ( ( ident. name , transparent ) ) ) ,
824837 expansion. to_expn_id ( ) ,
825838 item. span ,
826839 parent. no_implicit_prelude
@@ -852,7 +865,7 @@ impl<'a, 'ra, 'tcx> BuildReducedGraphVisitor<'a, 'ra, 'tcx> {
852865
853866 self . parent_scope . module = self . r . new_local_module (
854867 Some ( parent) ,
855- ModuleKind :: Def ( def_kind, def_id, Some ( ident. name ) ) ,
868+ ModuleKind :: Def ( def_kind, def_id, Some ( ( ident. name , false ) ) ) ,
856869 expansion. to_expn_id ( ) ,
857870 item. span ,
858871 parent. no_implicit_prelude ,
0 commit comments