rustc: Handle #[link(name = "")] error

This commit is contained in:
klutzy 2013-12-20 00:29:39 +09:00
parent e86cdaf23d
commit 2afa97a346
2 changed files with 6 additions and 1 deletions

View file

@ -219,7 +219,11 @@ fn visit_item(e: &Env, i: @ast::item) {
@"foo"
}
};
cstore::add_used_library(cstore, n.to_owned(), kind);
if n.is_empty() {
e.sess.span_err(m.span, "#[link(name = \"\")] given with empty name");
} else {
cstore::add_used_library(cstore, n.to_owned(), kind);
}
}
None => {}
}

View file

@ -9,6 +9,7 @@
// except according to those terms.
#[link()] //~ ERROR: specified without `name =
#[link(name = "")] //~ ERROR: with empty name
#[link(name = "foo")]
#[link(name = "foo", kind = "bar")] //~ ERROR: unknown kind
extern {}