@@ -664,7 +664,7 @@ pub fn translate(
664664 if t. tcfg . reorganize_definitions
665665 && decl_file_id. map_or ( false , |id| id != t. main_file )
666666 {
667- let name: Option < & String > = t
667+ let name = t
668668 . ast_context
669669 . get_decl ( & decl_id)
670670 . and_then ( |x| x. kind . get_name ( ) ) ;
@@ -941,12 +941,13 @@ impl<'a> IdentsOrGlob<'a> {
941941
942942/// Extract the set of names made visible by a `use`.
943943fn use_idents < ' a > ( i : & ' a UseTree ) -> IdentsOrGlob < ' a > {
944+ use UseTree :: * ;
944945 match i {
945- UseTree :: Path ( up) => use_idents ( & up. tree ) ,
946- UseTree :: Name ( un) => IdentsOrGlob :: Idents ( vec ! [ & un. ident] ) ,
947- UseTree :: Rename ( ur) => IdentsOrGlob :: Idents ( vec ! [ & ur. rename] ) ,
948- UseTree :: Glob ( _ugl) => IdentsOrGlob :: Glob ,
949- UseTree :: Group ( ugr) => ugr
946+ Path ( up) => use_idents ( & up. tree ) ,
947+ Name ( un) => IdentsOrGlob :: Idents ( vec ! [ & un. ident] ) ,
948+ Rename ( ur) => IdentsOrGlob :: Idents ( vec ! [ & ur. rename] ) ,
949+ Glob ( _ugl) => IdentsOrGlob :: Glob ,
950+ Group ( ugr) => ugr
950951 . items
951952 . iter ( )
952953 . map ( |tree| use_idents ( tree) )
@@ -1078,37 +1079,38 @@ fn make_submodule(
10781079
10791080 // Consumers will `use` reexported items at their exported locations.
10801081 for item in uses. into_items ( ) {
1081- if let Item :: Use ( ItemUse {
1082- vis : Visibility :: Public ( _) ,
1083- tree,
1084- ..
1085- } ) = & * item
1086- {
1087- match use_idents ( tree) {
1088- IdentsOrGlob :: Idents ( idents) => {
1089- for ident in idents {
1090- fn is_simd_type_name ( name : & str ) -> bool {
1091- const SIMD_TYPE_NAMES : & [ & str ] = & [
1092- "__m128i" , "__m128" , "__m128d" , "__m64" , "__m256" , "__m256d" ,
1093- "__m256i" ,
1094- ] ;
1095- SIMD_TYPE_NAMES . contains ( & name) || name. starts_with ( "_mm_" )
1096- }
1097- let name = & * ident. to_string ( ) ;
1098- if is_simd_type_name ( name) {
1099- // Import vector type/operation names from the stdlib, as we also generate
1100- // other uses for them from that location and can't easily reason about
1101- // the ultimate target of reexported names when avoiding duplicate imports
1102- // (which are verboten).
1103- simd:: add_arch_use ( use_item_store, "x86" , name) ;
1104- simd:: add_arch_use ( use_item_store, "x86_64" , name) ;
1105- } else {
1106- // Add a `use` for `self::this_module::exported_name`.
1107- use_item_store. add_use ( false , use_path ( ) , name) ;
1108- }
1109- }
1110- }
1111- IdentsOrGlob :: Glob => { }
1082+ let tree = match & * item {
1083+ Item :: Use ( ItemUse {
1084+ vis : Visibility :: Public ( _) ,
1085+ tree,
1086+ ..
1087+ } ) => tree,
1088+ _ => continue ,
1089+ } ;
1090+ let idents = match use_idents ( tree) {
1091+ IdentsOrGlob :: Idents ( idents) => idents,
1092+ IdentsOrGlob :: Glob => continue ,
1093+ } ;
1094+
1095+ fn is_simd_type_name ( name : & str ) -> bool {
1096+ const SIMD_TYPE_NAMES : & [ & str ] = & [
1097+ "__m128i" , "__m128" , "__m128d" , "__m64" , "__m256" , "__m256d" , "__m256i" ,
1098+ ] ;
1099+ SIMD_TYPE_NAMES . contains ( & name) || name. starts_with ( "_mm_" )
1100+ }
1101+
1102+ for ident in idents {
1103+ let name = & * ident. to_string ( ) ;
1104+ if is_simd_type_name ( name) {
1105+ // Import vector type/operation names from the stdlib, as we also generate
1106+ // other uses for them from that location and can't easily reason about
1107+ // the ultimate target of reexported names when avoiding duplicate imports
1108+ // (which are verboten).
1109+ simd:: add_arch_use ( use_item_store, "x86" , name) ;
1110+ simd:: add_arch_use ( use_item_store, "x86_64" , name) ;
1111+ } else {
1112+ // Add a `use` for `self::this_module::exported_name`.
1113+ use_item_store. add_use ( false , use_path ( ) , name) ;
11121114 }
11131115 }
11141116 items. push ( item) ;
0 commit comments