]> git.lizzy.rs Git - rust.git/commitdiff
rustdoc: get back missing crate-name when --playground-url is used
authorLiigo Zhuang <com.liigo@gmail.com>
Fri, 18 Nov 2016 02:40:51 +0000 (10:40 +0800)
committerLiigo Zhuang <com.liigo@gmail.com>
Wed, 30 Nov 2016 02:33:22 +0000 (10:33 +0800)
follow up PR #37763

src/librustdoc/html/render.rs

index 757db81c4402196fc43e77a6547639117b591b0e..7fa2e5cbdd7c131dfe3cb0eb48c43ec7d6164833 100644 (file)
@@ -451,6 +451,14 @@ pub fn run(mut krate: clean::Crate,
         css_file_extension: css_file_extension.clone(),
     };
 
+    // If user passed in `--playground-url` arg, we fill in crate name here
+    markdown::PLAYGROUND.with(|slot| {
+        if slot.borrow().is_some() {
+            let url = slot.borrow().as_ref().unwrap().1.clone();
+            *slot.borrow_mut() = Some((Some(krate.name.clone()), url));
+        }
+    });
+
     // Crawl the crate attributes looking for attributes which control how we're
     // going to emit HTML
     if let Some(attrs) = krate.module.as_ref().map(|m| &m.attrs) {