Skip to content

Commit c265180

Browse files
Move error codes to shared context
1 parent 98c94f6 commit c265180

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/librustdoc/html/render.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,6 @@ struct Context {
163163
/// real location of an item. This is used to allow external links to
164164
/// publicly reused items to redirect to the right location.
165165
pub render_redirect_pages: bool,
166-
pub codes: ErrorCodes,
167166
/// The map used to ensure all generated 'id=' attributes are unique.
168167
id_map: Rc<RefCell<IdMap>>,
169168
pub shared: Arc<SharedContext>,
@@ -208,6 +207,7 @@ crate struct SharedContext {
208207
pub fs: DocFS,
209208
/// The default edition used to parse doctests.
210209
pub edition: Edition,
210+
pub codes: ErrorCodes,
211211
}
212212

213213
impl SharedContext {
@@ -540,6 +540,7 @@ pub fn run(mut krate: clean::Crate,
540540
generate_redirect_pages,
541541
fs: DocFS::new(&errors),
542542
edition,
543+
codes: ErrorCodes::from(UnstableFeatures::from_environment().is_nightly_build()),
543544
};
544545

545546
// 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
current: Vec::new(),
586587
dst,
587588
render_redirect_pages: false,
588-
codes: ErrorCodes::from(UnstableFeatures::from_environment().is_nightly_build()),
589589
id_map: Rc::new(RefCell::new(id_map)),
590590
shared: Arc::new(scx),
591591
playground,
@@ -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.shared.edition, &cx.playground).to_string())
2356+
cx.shared.codes, cx.shared.edition, &cx.playground).to_string())
23572357
}
23582358

23592359
fn document_short(
@@ -3961,7 +3961,7 @@ fn render_impl(w: &mut Buffer, cx: &Context, i: &Impl, link: AssocItemLink<'_>,
39613961
let mut ids = cx.id_map.borrow_mut();
39623962
write!(w, "<div class='docblock'>{}</div>",
39633963
Markdown(&*dox, &i.impl_item.links(), &mut ids,
3964-
cx.codes, cx.shared.edition, &cx.playground).to_string());
3964+
cx.shared.codes, cx.shared.edition, &cx.playground).to_string());
39653965
}
39663966
}
39673967

0 commit comments

Comments
 (0)