diff options
| author | Liigo Zhuang <com.liigo@gmail.com> | 2016-11-18 10:40:51 +0800 |
|---|---|---|
| committer | Liigo Zhuang <com.liigo@gmail.com> | 2016-11-30 10:33:22 +0800 |
| commit | c1a6f17031e95e74f55624e500ae8417334868ee (patch) | |
| tree | d20b40819dcf558b27bb5d659c616360d084f596 | |
| parent | b30022a1d32ebbd41f6623ab6fe7c62d489548e1 (diff) | |
| download | rust-c1a6f17031e95e74f55624e500ae8417334868ee.tar.gz rust-c1a6f17031e95e74f55624e500ae8417334868ee.zip | |
rustdoc: get back missing crate-name when --playground-url is used
follow up PR #37763
| -rw-r--r-- | src/librustdoc/html/render.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index 757db81c440..7fa2e5cbdd7 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -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) { |
