Skip to content

Commit 297a054

Browse files
lhtbrson
authored andcommitted
---
yaml --- r: 6061 b: refs/heads/master c: 16dad84 h: refs/heads/master i: 6059: f8a77a3 v: v3
1 parent 1160fb0 commit 297a054

File tree

2 files changed

+10
-23
lines changed

2 files changed

+10
-23
lines changed

[refs]

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 329f045d4c5f27275dcf1cadf8d0f51919ba8027
2+
refs/heads/master: 16dad84f7b2f173db012dda2e77b08ccb423391f

trunk/src/comp/metadata/creader.rs

+9-22
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)