@@ -1090,31 +1090,31 @@ impl<'a, 'b> ImportResolver<'a, 'b> {
10901090 // Since import resolution is finished, globs will not define any more names.
10911091 * module. globs . borrow_mut ( ) = Vec :: new ( ) ;
10921092
1093- let mut reexports = Vec :: new ( ) ;
1094-
1095- module. for_each_child ( self . r , |_, ident, _, binding| {
1096- // FIXME: Consider changing the binding inserted by `#[macro_export] macro_rules`
1097- // into the crate root to actual `NameBindingKind::Import`.
1098- if binding. is_import ( )
1099- || matches ! ( binding. kind, NameBindingKind :: Res ( _, _is_macro_export @ true ) )
1100- {
1101- let res = binding. res ( ) . expect_non_local ( ) ;
1102- // Ambiguous imports are treated as errors at this point and are
1103- // not exposed to other crates (see #36837 for more details).
1104- if res != def:: Res :: Err && !binding. is_ambiguity ( ) {
1105- reexports. push ( ModChild {
1106- ident,
1107- res,
1108- vis : binding. vis ,
1109- span : binding. span ,
1110- macro_rules : false ,
1111- } ) ;
1093+ if let Some ( def_id) = module. opt_def_id ( ) {
1094+ let mut reexports = Vec :: new ( ) ;
1095+
1096+ module. for_each_child ( self . r , |_, ident, _, binding| {
1097+ // FIXME: Consider changing the binding inserted by `#[macro_export] macro_rules`
1098+ // into the crate root to actual `NameBindingKind::Import`.
1099+ if binding. is_import ( )
1100+ || matches ! ( binding. kind, NameBindingKind :: Res ( _, _is_macro_export @ true ) )
1101+ {
1102+ let res = binding. res ( ) . expect_non_local ( ) ;
1103+ // Ambiguous imports are treated as errors at this point and are
1104+ // not exposed to other crates (see #36837 for more details).
1105+ if res != def:: Res :: Err && !binding. is_ambiguity ( ) {
1106+ reexports. push ( ModChild {
1107+ ident,
1108+ res,
1109+ vis : binding. vis ,
1110+ span : binding. span ,
1111+ macro_rules : false ,
1112+ } ) ;
1113+ }
11121114 }
1113- }
1114- } ) ;
1115+ } ) ;
11151116
1116- if !reexports. is_empty ( ) {
1117- if let Some ( def_id) = module. opt_def_id ( ) {
1117+ if !reexports. is_empty ( ) {
11181118 // Call to `expect_local` should be fine because current
11191119 // code is only called for local modules.
11201120 self . r . reexport_map . insert ( def_id. expect_local ( ) , reexports) ;
0 commit comments