Skip to content

Commit bb02d14

Browse files
committed
auto merge of #11073 : klutzy/rust/issue-10978, r=alexcrichton
This patchset fixes small glitches which caused #10978.
2 parents 415e55a + da818e9 commit bb02d14

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

src/etc/mklldeps.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
f = open(sys.argv[1], 'wb')
88

99
components = sys.argv[2].split(' ')
10+
components = [i for i in components if i] # ignore extra whitespaces
1011

1112
f.write("""// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
1213
// file at the top-level directory of this distribution and at
@@ -51,6 +52,10 @@
5152
proc = subprocess.Popen(args, stdout = subprocess.PIPE)
5253
out, err = proc.communicate()
5354

55+
if err:
56+
print("failed to run llconfig: args = `{}`".format(args))
57+
sys.exit(1)
58+
5459
for lib in out.strip().split(' '):
5560
lib = lib[2:] # chop of the leading '-l'
5661
f.write("#[link(name = \"" + lib + "\", kind = \"static\")]\n")

src/librustc/metadata/creader.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,11 @@ fn visit_item(e: &Env, i: @ast::item) {
219219
@"foo"
220220
}
221221
};
222-
cstore::add_used_library(cstore, n.to_owned(), kind);
222+
if n.is_empty() {
223+
e.sess.span_err(m.span, "#[link(name = \"\")] given with empty name");
224+
} else {
225+
cstore::add_used_library(cstore, n.to_owned(), kind);
226+
}
223227
}
224228
None => {}
225229
}

src/test/compile-fail/bad-extern-link-attrs.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
// except according to those terms.
1010

1111
#[link()] //~ ERROR: specified without `name =
12+
#[link(name = "")] //~ ERROR: with empty name
1213
#[link(name = "foo")]
1314
#[link(name = "foo", kind = "bar")] //~ ERROR: unknown kind
1415
extern {}

0 commit comments

Comments
 (0)