@@ -119,37 +119,24 @@ fn find_library_crate(sess: session::session, ident: ast::ident,
119
119
120
120
attr:: require_unique_names ( sess, metas) ;
121
121
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
+ }
138
127
let nn = default_native_lib_naming ( sess, sess. get_opts ( ) . static ) ;
139
128
let x =
140
- find_library_crate_aux ( nn, crate_name, metas,
141
- sess. filesearch ( ) ) ;
129
+ find_library_crate_aux ( nn, metas, sess. filesearch ( ) ) ;
142
130
if x != none || sess. get_opts ( ) . static { ret x; }
143
131
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 ( ) ) ;
146
133
}
147
134
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 } ,
149
136
metas : [ @ast:: meta_item ] ,
150
137
filesearch : filesearch:: filesearch ) ->
151
138
option:: t < { ident: str , data : @[ u8 ] } > {
152
- let prefix: str = nn. prefix + crate_name ;
139
+ let prefix: str = nn. prefix ;
153
140
let suffix: str = nn. suffix ;
154
141
155
142
ret filesearch:: search ( filesearch, { |path|
0 commit comments