Skip to content

Commit 423963c

Browse files
committed
Remove unnecessary edition field on SharedContext
1 parent 640cc74 commit 423963c

File tree

4 files changed

+10
-9
lines changed

4 files changed

+10
-9
lines changed

src/librustdoc/html/render/context.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,6 @@ crate struct SharedContext<'tcx> {
111111
crate static_root_path: Option<String>,
112112
/// The fs handle we are working with.
113113
crate fs: DocFS,
114-
/// The default edition used to parse doctests.
115-
crate edition: Edition,
116114
pub(super) codes: ErrorCodes,
117115
pub(super) playground: Option<markdown::Playground>,
118116
all: RefCell<AllTypes>,
@@ -141,6 +139,10 @@ impl SharedContext<'_> {
141139
crate fn maybe_collapsed_doc_value<'a>(&self, item: &'a clean::Item) -> Option<String> {
142140
if self.collapsed { item.collapsed_doc_value() } else { item.doc_value() }
143141
}
142+
143+
crate fn edition(&self) -> Edition {
144+
self.tcx.sess.edition()
145+
}
144146
}
145147

146148
impl<'tcx> Context<'tcx> {
@@ -434,7 +436,6 @@ impl<'tcx> FormatRenderer<'tcx> for Context<'tcx> {
434436
resource_suffix,
435437
static_root_path,
436438
fs: DocFS::new(sender),
437-
edition: tcx.sess.edition(),
438439
codes: ErrorCodes::from(unstable_features.is_nightly_build()),
439440
playground,
440441
all: RefCell::new(AllTypes::new()),

src/librustdoc/html/render/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,7 @@ fn render_markdown(
530530
&links,
531531
&mut ids,
532532
cx.shared.codes,
533-
cx.shared.edition,
533+
cx.shared.edition(),
534534
&cx.shared.playground
535535
)
536536
.into_string()
@@ -660,7 +660,7 @@ fn short_item_info(
660660
&note,
661661
&mut ids,
662662
error_codes,
663-
cx.shared.edition,
663+
cx.shared.edition(),
664664
&cx.shared.playground,
665665
);
666666
message.push_str(&format!(": {}", html.into_string()));
@@ -702,7 +702,7 @@ fn short_item_info(
702702
&unstable_reason.as_str(),
703703
&mut ids,
704704
error_codes,
705-
cx.shared.edition,
705+
cx.shared.edition(),
706706
&cx.shared.playground,
707707
)
708708
.into_string()
@@ -1358,7 +1358,7 @@ fn render_impl(
13581358
&i.impl_item.links(cx),
13591359
&mut ids,
13601360
cx.shared.codes,
1361-
cx.shared.edition,
1361+
cx.shared.edition(),
13621362
&cx.shared.playground
13631363
)
13641364
.into_string()

src/librustdoc/html/render/write_shared.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ pub(super) fn write_shared(
425425
md_opts.output = cx.dst.clone();
426426
md_opts.external_html = (*cx.shared).layout.external_html.clone();
427427

428-
crate::markdown::render(&index_page, md_opts, cx.shared.edition)
428+
crate::markdown::render(&index_page, md_opts, cx.shared.edition())
429429
.map_err(|e| Error::new(e, &index_page))?;
430430
} else {
431431
let dst = cx.dst.join("index.html");

src/librustdoc/html/sources.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ impl SourceCollector<'_, 'tcx> {
129129
&self.scx.layout,
130130
&page,
131131
"",
132-
|buf: &mut _| print_src(buf, contents, self.scx.edition),
132+
|buf: &mut _| print_src(buf, contents, self.scx.edition()),
133133
&self.scx.style_files,
134134
);
135135
self.scx.fs.write(&cur, v.as_bytes())?;

0 commit comments

Comments
 (0)