@@ -1277,23 +1277,36 @@ impl<'test> TestCx<'test> {
12771277 . replace ( '-' , "_" )
12781278 } ;
12791279
1280- let add_extern =
1281- |rustc : & mut Command , aux_name : & str , aux_path : & str , aux_type : AuxType | {
1282- let lib_name = get_lib_name ( & path_to_crate_name ( aux_path) , aux_type) ;
1283- if let Some ( lib_name) = lib_name {
1284- rustc. arg ( "--extern" ) . arg ( format ! ( "{}={}/{}" , aux_name, aux_dir, lib_name) ) ;
1285- }
1286- } ;
1280+ let add_extern = |rustc : & mut Command ,
1281+ extern_modifiers : Option < & str > ,
1282+ aux_name : & str ,
1283+ aux_path : & str ,
1284+ aux_type : AuxType | {
1285+ let lib_name = get_lib_name ( & path_to_crate_name ( aux_path) , aux_type) ;
1286+ if let Some ( lib_name) = lib_name {
1287+ let modifiers_and_name = match extern_modifiers {
1288+ Some ( modifiers) => format ! ( "{modifiers}:{aux_name}" ) ,
1289+ None => aux_name. to_string ( ) ,
1290+ } ;
1291+ rustc. arg ( "--extern" ) . arg ( format ! ( "{modifiers_and_name}={aux_dir}/{lib_name}" ) ) ;
1292+ }
1293+ } ;
12871294
1288- for AuxCrate { name, path } in & self . props . aux . crates {
1295+ for AuxCrate { extern_modifiers , name, path } in & self . props . aux . crates {
12891296 let aux_type = self . build_auxiliary ( & path, & aux_dir, None ) ;
1290- add_extern ( rustc, name, path, aux_type) ;
1297+ add_extern ( rustc, extern_modifiers . as_deref ( ) , name, path, aux_type) ;
12911298 }
12921299
12931300 for proc_macro in & self . props . aux . proc_macros {
12941301 self . build_auxiliary ( proc_macro, & aux_dir, Some ( AuxType :: ProcMacro ) ) ;
12951302 let crate_name = path_to_crate_name ( proc_macro) ;
1296- add_extern ( rustc, & crate_name, proc_macro, AuxType :: ProcMacro ) ;
1303+ add_extern (
1304+ rustc,
1305+ None , // `extern_modifiers`
1306+ & crate_name,
1307+ proc_macro,
1308+ AuxType :: ProcMacro ,
1309+ ) ;
12971310 }
12981311
12991312 // Build any `//@ aux-codegen-backend`, and pass the resulting library
0 commit comments