@@ -290,23 +290,16 @@ pub fn compile_input(context: &BuildContext,
290
290
addl_lib_search_paths. insert ( p) ;
291
291
} ) ;
292
292
293
- // Inject the link attributes so we get the right package name and version
294
- if attr:: find_linkage_metas ( crate . attrs) . is_empty ( ) {
295
- let name_to_use = match what {
296
- Test => format ! ( "{}test" , pkg_id. short_name) . to_managed ( ) ,
297
- Bench => format ! ( "{}bench" , pkg_id. short_name) . to_managed ( ) ,
298
- _ => pkg_id. short_name . to_managed ( )
299
- } ;
300
- debug ! ( "Injecting link name: {}" , name_to_use) ;
293
+ // Inject the pkgid attribute so we get the right package name and version
294
+
295
+ if !attr:: contains_name ( crate . attrs, "pkgid" ) {
301
296
// FIXME (#9639): This needs to handle non-utf8 paths
302
- let link_options =
303
- ~[ attr:: mk_name_value_item_str ( @"name", name_to_use) ,
304
- attr:: mk_name_value_item_str ( @"vers", pkg_id. version . to_str ( ) . to_managed ( ) ) ] +
305
- ~[ attr:: mk_name_value_item_str ( @"package_id",
306
- pkg_id. path . as_str ( ) . unwrap ( ) . to_managed ( ) ) ] ;
307
-
308
- debug ! ( "link options: {:?}" , link_options) ;
309
- crate . attrs = ~[ attr:: mk_attr ( attr:: mk_list_item ( @"link", link_options) ) ] ;
297
+ let pkgid_attr =
298
+ attr:: mk_name_value_item_str ( @"pkgid",
299
+ pkg_id. path . as_str ( ) . unwrap ( ) . to_managed ( ) ) ;
300
+
301
+ debug ! ( "pkgid attr: {:?}" , pkgid_attr) ;
302
+ crate . attrs = ~[ attr:: mk_attr ( pkgid_attr) ] ;
310
303
}
311
304
312
305
debug ! ( "calling compile_crate_from_input, workspace = {},
0 commit comments