Move edition field out of Context
This commit is contained in:
parent
e0e0c3787c
commit
98c94f6f77
1 changed files with 9 additions and 8 deletions
|
@ -164,8 +164,6 @@ struct Context {
|
||||||
/// publicly reused items to redirect to the right location.
|
/// publicly reused items to redirect to the right location.
|
||||||
pub render_redirect_pages: bool,
|
pub render_redirect_pages: bool,
|
||||||
pub codes: ErrorCodes,
|
pub codes: ErrorCodes,
|
||||||
/// The default edition used to parse doctests.
|
|
||||||
pub edition: Edition,
|
|
||||||
/// The map used to ensure all generated 'id=' attributes are unique.
|
/// The map used to ensure all generated 'id=' attributes are unique.
|
||||||
id_map: Rc<RefCell<IdMap>>,
|
id_map: Rc<RefCell<IdMap>>,
|
||||||
pub shared: Arc<SharedContext>,
|
pub shared: Arc<SharedContext>,
|
||||||
|
@ -208,6 +206,8 @@ crate struct SharedContext {
|
||||||
pub generate_redirect_pages: bool,
|
pub generate_redirect_pages: bool,
|
||||||
/// The fs handle we are working with.
|
/// The fs handle we are working with.
|
||||||
pub fs: DocFS,
|
pub fs: DocFS,
|
||||||
|
/// The default edition used to parse doctests.
|
||||||
|
pub edition: Edition,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl SharedContext {
|
impl SharedContext {
|
||||||
|
@ -539,6 +539,7 @@ pub fn run(mut krate: clean::Crate,
|
||||||
static_root_path,
|
static_root_path,
|
||||||
generate_redirect_pages,
|
generate_redirect_pages,
|
||||||
fs: DocFS::new(&errors),
|
fs: DocFS::new(&errors),
|
||||||
|
edition,
|
||||||
};
|
};
|
||||||
|
|
||||||
// If user passed in `--playground-url` arg, we fill in crate name here
|
// If user passed in `--playground-url` arg, we fill in crate name here
|
||||||
|
@ -585,7 +586,6 @@ pub fn run(mut krate: clean::Crate,
|
||||||
dst,
|
dst,
|
||||||
render_redirect_pages: false,
|
render_redirect_pages: false,
|
||||||
codes: ErrorCodes::from(UnstableFeatures::from_environment().is_nightly_build()),
|
codes: ErrorCodes::from(UnstableFeatures::from_environment().is_nightly_build()),
|
||||||
edition,
|
|
||||||
id_map: Rc::new(RefCell::new(id_map)),
|
id_map: Rc::new(RefCell::new(id_map)),
|
||||||
shared: Arc::new(scx),
|
shared: Arc::new(scx),
|
||||||
playground,
|
playground,
|
||||||
|
@ -1134,7 +1134,7 @@ themePicker.onblur = handleThemeButtonsBlur;
|
||||||
md_opts.output = cx.dst.clone();
|
md_opts.output = cx.dst.clone();
|
||||||
md_opts.external_html = (*cx.shared).layout.external_html.clone();
|
md_opts.external_html = (*cx.shared).layout.external_html.clone();
|
||||||
|
|
||||||
crate::markdown::render(index_page, md_opts, diag, cx.edition);
|
crate::markdown::render(index_page, md_opts, diag, cx.shared.edition);
|
||||||
} else {
|
} else {
|
||||||
let dst = cx.dst.join("index.html");
|
let dst = cx.dst.join("index.html");
|
||||||
let page = layout::Page {
|
let page = layout::Page {
|
||||||
|
@ -2353,7 +2353,7 @@ fn render_markdown(
|
||||||
if is_hidden { " hidden" } else { "" },
|
if is_hidden { " hidden" } else { "" },
|
||||||
prefix,
|
prefix,
|
||||||
Markdown(md_text, &links, &mut ids,
|
Markdown(md_text, &links, &mut ids,
|
||||||
cx.codes, cx.edition, &cx.playground).to_string())
|
cx.codes, cx.shared.edition, &cx.playground).to_string())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn document_short(
|
fn document_short(
|
||||||
|
@ -2710,7 +2710,8 @@ fn short_stability(item: &clean::Item, cx: &Context) -> Vec<String> {
|
||||||
|
|
||||||
if let Some(note) = note {
|
if let Some(note) = note {
|
||||||
let mut ids = cx.id_map.borrow_mut();
|
let mut ids = cx.id_map.borrow_mut();
|
||||||
let html = MarkdownHtml(¬e, &mut ids, error_codes, cx.edition, &cx.playground);
|
let html = MarkdownHtml(
|
||||||
|
¬e, &mut ids, error_codes, cx.shared.edition, &cx.playground);
|
||||||
message.push_str(&format!(": {}", html.to_string()));
|
message.push_str(&format!(": {}", html.to_string()));
|
||||||
}
|
}
|
||||||
stability.push(format!("<div class='stab deprecated'>{}</div>", message));
|
stability.push(format!("<div class='stab deprecated'>{}</div>", message));
|
||||||
|
@ -2763,7 +2764,7 @@ fn short_stability(item: &clean::Item, cx: &Context) -> Vec<String> {
|
||||||
&unstable_reason,
|
&unstable_reason,
|
||||||
&mut ids,
|
&mut ids,
|
||||||
error_codes,
|
error_codes,
|
||||||
cx.edition,
|
cx.shared.edition,
|
||||||
&cx.playground,
|
&cx.playground,
|
||||||
).to_string()
|
).to_string()
|
||||||
);
|
);
|
||||||
|
@ -3960,7 +3961,7 @@ fn render_impl(w: &mut Buffer, cx: &Context, i: &Impl, link: AssocItemLink<'_>,
|
||||||
let mut ids = cx.id_map.borrow_mut();
|
let mut ids = cx.id_map.borrow_mut();
|
||||||
write!(w, "<div class='docblock'>{}</div>",
|
write!(w, "<div class='docblock'>{}</div>",
|
||||||
Markdown(&*dox, &i.impl_item.links(), &mut ids,
|
Markdown(&*dox, &i.impl_item.links(), &mut ids,
|
||||||
cx.codes, cx.edition, &cx.playground).to_string());
|
cx.codes, cx.shared.edition, &cx.playground).to_string());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue