Skip to content

Commit 386b455

Browse files
committed
auto merge of #10948 : cmr/rust/update_pkgid, r=metajack
2 parents 7f5787a + b20aa5b commit 386b455

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

src/librustdoc/clean.rs

+4-7
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,7 @@ pub struct Crate {
7373

7474
impl Clean<Crate> for visit_ast::RustdocVisitor {
7575
fn clean(&self) -> Crate {
76-
use syntax::attr::{find_linkage_metas, last_meta_item_value_str_by_name};
77-
let maybe_meta = last_meta_item_value_str_by_name(
78-
find_linkage_metas(self.attrs), "name");
76+
use syntax::attr::find_pkgid;
7977
let cx = local_data::get(super::ctxtkey, |x| *x.unwrap());
8078

8179
let mut externs = HashMap::new();
@@ -84,10 +82,9 @@ impl Clean<Crate> for visit_ast::RustdocVisitor {
8482
});
8583

8684
Crate {
87-
name: match maybe_meta {
88-
Some(x) => x.to_owned(),
89-
None => fail!("rustdoc requires a \\#[link(name=\"foo\")] \
90-
crate attribute"),
85+
name: match find_pkgid(self.attrs) {
86+
Some(n) => n.name,
87+
None => fail!("rustdoc requires a `pkgid` crate attribute"),
9188
},
9289
module: Some(self.module.clean()),
9390
externs: externs,

src/librustpkg/util.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ pub fn compile_input(context: &BuildContext,
300300
pkg_id.version.to_str()).to_managed());
301301

302302
debug!("pkgid attr: {:?}", pkgid_attr);
303-
crate.attrs = ~[attr::mk_attr(pkgid_attr)];
303+
crate.attrs.push(attr::mk_attr(pkgid_attr));
304304
}
305305

306306
debug!("calling compile_crate_from_input, workspace = {},

0 commit comments

Comments
 (0)