@@ -125,25 +125,39 @@ fn find_library_crate(sess: session::session, ident: ast::ident,
125
125
attr:: require_unique_names ( sess, metas) ;
126
126
let metas = metas;
127
127
128
- // Metadata "name" will be used to find the crate. Use `ident'
129
- // as "name" if the attribute is not explicitly specified
130
- if !attr:: contains_name ( metas, "name" ) {
131
- metas += [ attr:: mk_name_value_item_str ( "name" , ident) ] ;
132
- }
128
+ let crate_name =
129
+ {
130
+ let name_items = attr:: find_meta_items_by_name ( metas, "name" ) ;
131
+ alt vec:: last ( name_items) {
132
+ some ( i) {
133
+ alt attr:: get_meta_item_value_str ( i) {
134
+ some ( n) { n }
135
+ // FIXME: Probably want a warning here since the user
136
+ // is using the wrong type of meta item
137
+ _ { ident }
138
+ }
139
+ }
140
+ none. { ident }
141
+ }
142
+ } ;
143
+
133
144
let nn = default_native_lib_naming ( sess, sess. get_opts ( ) . static ) ;
134
145
let x =
135
- find_library_crate_aux ( sess, nn, metas, sess. filesearch ( ) ) ;
146
+ find_library_crate_aux ( sess, nn, crate_name,
147
+ metas, sess. filesearch ( ) ) ;
136
148
if x != none || sess. get_opts ( ) . static { ret x; }
137
149
let nn2 = default_native_lib_naming ( sess, true ) ;
138
- ret find_library_crate_aux ( sess, nn2, metas, sess. filesearch ( ) ) ;
150
+ ret find_library_crate_aux ( sess, nn2, crate_name, metas,
151
+ sess. filesearch ( ) ) ;
139
152
}
140
153
141
154
fn find_library_crate_aux ( sess : session:: session ,
142
155
nn : { prefix : str , suffix : str } ,
156
+ crate_name : str ,
143
157
metas : [ @ast:: meta_item ] ,
144
158
filesearch : filesearch:: filesearch ) ->
145
159
option:: t < { ident: str , data : @[ u8 ] } > {
146
- let prefix: str = nn. prefix ;
160
+ let prefix: str = nn. prefix + crate_name ;
147
161
let suffix: str = nn. suffix ;
148
162
149
163
ret filesearch:: search ( filesearch, { |path|
0 commit comments