Skip to content

Commit 98c94f6

Browse files
Move edition field out of Context
1 parent e0e0c37 commit 98c94f6

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

src/librustdoc/html/render.rs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,6 @@ struct Context {
164164
/// publicly reused items to redirect to the right location.
165165
pub render_redirect_pages: bool,
166166
pub codes: ErrorCodes,
167-
/// The default edition used to parse doctests.
168-
pub edition: Edition,
169167
/// The map used to ensure all generated 'id=' attributes are unique.
170168
id_map: Rc<RefCell<IdMap>>,
171169
pub shared: Arc<SharedContext>,
@@ -208,6 +206,8 @@ crate struct SharedContext {
208206
pub generate_redirect_pages: bool,
209207
/// The fs handle we are working with.
210208
pub fs: DocFS,
209+
/// The default edition used to parse doctests.
210+
pub edition: Edition,
211211
}
212212

213213
impl SharedContext {
@@ -539,6 +539,7 @@ pub fn run(mut krate: clean::Crate,
539539
static_root_path,
540540
generate_redirect_pages,
541541
fs: DocFS::new(&errors),
542+
edition,
542543
};
543544

544545
// If user passed in `--playground-url` arg, we fill in crate name here
@@ -585,7 +586,6 @@ pub fn run(mut krate: clean::Crate,
585586
dst,
586587
render_redirect_pages: false,
587588
codes: ErrorCodes::from(UnstableFeatures::from_environment().is_nightly_build()),
588-
edition,
589589
id_map: Rc::new(RefCell::new(id_map)),
590590
shared: Arc::new(scx),
591591
playground,
@@ -1134,7 +1134,7 @@ themePicker.onblur = handleThemeButtonsBlur;
11341134
md_opts.output = cx.dst.clone();
11351135
md_opts.external_html = (*cx.shared).layout.external_html.clone();
11361136

1137-
crate::markdown::render(index_page, md_opts, diag, cx.edition);
1137+
crate::markdown::render(index_page, md_opts, diag, cx.shared.edition);
11381138
} else {
11391139
let dst = cx.dst.join("index.html");
11401140
let page = layout::Page {
@@ -2353,7 +2353,7 @@ fn render_markdown(
23532353
if is_hidden { " hidden" } else { "" },
23542354
prefix,
23552355
Markdown(md_text, &links, &mut ids,
2356-
cx.codes, cx.edition, &cx.playground).to_string())
2356+
cx.codes, cx.shared.edition, &cx.playground).to_string())
23572357
}
23582358

23592359
fn document_short(
@@ -2710,7 +2710,8 @@ fn short_stability(item: &clean::Item, cx: &Context) -> Vec<String> {
27102710

27112711
if let Some(note) = note {
27122712
let mut ids = cx.id_map.borrow_mut();
2713-
let html = MarkdownHtml(&note, &mut ids, error_codes, cx.edition, &cx.playground);
2713+
let html = MarkdownHtml(
2714+
&note, &mut ids, error_codes, cx.shared.edition, &cx.playground);
27142715
message.push_str(&format!(": {}", html.to_string()));
27152716
}
27162717
stability.push(format!("<div class='stab deprecated'>{}</div>", message));
@@ -2763,7 +2764,7 @@ fn short_stability(item: &clean::Item, cx: &Context) -> Vec<String> {
27632764
&unstable_reason,
27642765
&mut ids,
27652766
error_codes,
2766-
cx.edition,
2767+
cx.shared.edition,
27672768
&cx.playground,
27682769
).to_string()
27692770
);
@@ -3960,7 +3961,7 @@ fn render_impl(w: &mut Buffer, cx: &Context, i: &Impl, link: AssocItemLink<'_>,
39603961
let mut ids = cx.id_map.borrow_mut();
39613962
write!(w, "<div class='docblock'>{}</div>",
39623963
Markdown(&*dox, &i.impl_item.links(), &mut ids,
3963-
cx.codes, cx.edition, &cx.playground).to_string());
3964+
cx.codes, cx.shared.edition, &cx.playground).to_string());
39643965
}
39653966
}
39663967

0 commit comments

Comments
 (0)