Remove thread-local for playground config

This commit is contained in:
Mark Rousskov 2019-08-10 18:07:07 -04:00
parent ade8b02828
commit dbad77ffdd
6 changed files with 147 additions and 117 deletions

View file

@ -16,7 +16,7 @@ use std::cell::RefCell;
use syntax::edition::DEFAULT_EDITION;
use syntax::diagnostics::metadata::{get_metadata_dir, ErrorMetadataMap, ErrorMetadata};
use rustdoc::html::markdown::{Markdown, IdMap, ErrorCodes, PLAYGROUND};
use rustdoc::html::markdown::{Markdown, IdMap, ErrorCodes, Playground};
use rustc_serialize::json;
enum OutputFormat {
@ -95,9 +95,13 @@ impl Formatter for HTMLFormatter {
match info.description {
Some(ref desc) => {
let mut id_map = self.0.borrow_mut();
let playground = Playground {
crate_name: None,
url: String::from("https://play.rust-lang.org/"),
};
write!(output, "{}",
Markdown(desc, &[], RefCell::new(&mut id_map),
ErrorCodes::Yes, DEFAULT_EDITION))?
ErrorCodes::Yes, DEFAULT_EDITION, &Some(playground)))?
},
None => write!(output, "<p>No description.</p>\n")?,
}
@ -260,9 +264,6 @@ fn parse_args() -> (OutputFormat, PathBuf) {
fn main() {
env_logger::init();
PLAYGROUND.with(|slot| {
*slot.borrow_mut() = Some((None, String::from("https://play.rust-lang.org/")));
});
let (format, dst) = parse_args();
let result = syntax::with_default_globals(move || {
main_with_result(format, &dst)