Skip to content

Commit c1a6f17

Browse files
committed
rustdoc: get back missing crate-name when --playground-url is used
follow up PR rust-lang#37763
1 parent b30022a commit c1a6f17

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/librustdoc/html/render.rs

+8
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,14 @@ pub fn run(mut krate: clean::Crate,
451451
css_file_extension: css_file_extension.clone(),
452452
};
453453

454+
// If user passed in `--playground-url` arg, we fill in crate name here
455+
markdown::PLAYGROUND.with(|slot| {
456+
if slot.borrow().is_some() {
457+
let url = slot.borrow().as_ref().unwrap().1.clone();
458+
*slot.borrow_mut() = Some((Some(krate.name.clone()), url));
459+
}
460+
});
461+
454462
// Crawl the crate attributes looking for attributes which control how we're
455463
// going to emit HTML
456464
if let Some(attrs) = krate.module.as_ref().map(|m| &m.attrs) {

0 commit comments

Comments
 (0)