@@ -119,37 +119,24 @@ fn find_library_crate(sess: session::session, ident: ast::ident,
119119
120120 attr:: require_unique_names ( sess, metas) ;
121121
122- let crate_name =
123- {
124- let name_items = attr:: find_meta_items_by_name ( metas, "name" ) ;
125- alt vec:: last ( name_items) {
126- some ( i) {
127- alt attr:: get_meta_item_value_str ( i) {
128- some ( n) { n }
129- // FIXME: Probably want a warning here since the user
130- // is using the wrong type of meta item
131- _ { ident }
132- }
133- }
134- none. { ident }
135- }
136- } ;
137-
122+ // Metadata "name" will be used to find the crate. Use `ident'
123+ // as "name" if the attribute is not explicitly specified
124+ if !attr:: contains_name ( metas, "name" ) {
125+ metas += [ attr:: mk_name_value_item_str ( "name" , ident) ] ;
126+ }
138127 let nn = default_native_lib_naming ( sess, sess. get_opts ( ) . static ) ;
139128 let x =
140- find_library_crate_aux ( nn, crate_name, metas,
141- sess. filesearch ( ) ) ;
129+ find_library_crate_aux ( nn, metas, sess. filesearch ( ) ) ;
142130 if x != none || sess. get_opts ( ) . static { ret x; }
143131 let nn2 = default_native_lib_naming ( sess, true ) ;
144- ret find_library_crate_aux ( nn2, crate_name, metas,
145- sess. filesearch ( ) ) ;
132+ ret find_library_crate_aux ( nn2, metas, sess. filesearch ( ) ) ;
146133}
147134
148- fn find_library_crate_aux ( nn : { prefix : str , suffix : str } , crate_name : str ,
135+ fn find_library_crate_aux ( nn : { prefix : str , suffix : str } ,
149136 metas : [ @ast:: meta_item ] ,
150137 filesearch : filesearch:: filesearch ) ->
151138 option:: t < { ident: str , data : @[ u8 ] } > {
152- let prefix: str = nn. prefix + crate_name ;
139+ let prefix: str = nn. prefix ;
153140 let suffix: str = nn. suffix ;
154141
155142 ret filesearch:: search ( filesearch, { |path|
0 commit comments