diff --git a/src/librustdoc/html/render/context.rs b/src/librustdoc/html/render/context.rs
index 064c9759b58..e8d323b9af1 100644
--- a/src/librustdoc/html/render/context.rs
+++ b/src/librustdoc/html/render/context.rs
@@ -44,15 +44,20 @@ use crate::html::{layout, sources};
crate struct Context<'tcx> {
/// Current hierarchy of components leading down to what's currently being
/// rendered
- crate current: Vec,
+ pub(super) current: Vec,
/// The current destination folder of where HTML artifacts should be placed.
/// This changes as the context descends into the module hierarchy.
- crate dst: PathBuf,
+ pub(super) dst: PathBuf,
/// A flag, which when `true`, will render pages which redirect to the
/// real location of an item. This is used to allow external links to
/// publicly reused items to redirect to the right location.
- crate render_redirect_pages: bool,
- crate shared: Rc>,
+ pub(super) render_redirect_pages: bool,
+ /// Shared mutable state.
+ ///
+ /// Issue for improving the situation: [#82381][]
+ ///
+ /// [#82381]: https://github.com/rust-lang/rust/issues/82381
+ pub(super) shared: Rc>,
/// The [`Cache`] used during rendering.
///
/// Ideally the cache would be in [`SharedContext`], but it's mutated
@@ -62,7 +67,7 @@ crate struct Context<'tcx> {
/// It's immutable once in `Context`, so it's not as bad that it's not in
/// `SharedContext`.
// FIXME: move `cache` to `SharedContext`
- crate cache: Rc,
+ pub(super) cache: Rc,
}
impl<'tcx> Context<'tcx> {
diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs
index 3bb13d29992..c074b789e74 100644
--- a/src/librustdoc/html/render/mod.rs
+++ b/src/librustdoc/html/render/mod.rs
@@ -81,6 +81,7 @@ crate fn ensure_trailing_slash(v: &str) -> impl fmt::Display + '_ {
})
}
+/// Shared mutable state used in [`Context`] and elsewhere.
crate struct SharedContext<'tcx> {
crate tcx: TyCtxt<'tcx>,
/// The path to the crate root source minus the file name.
@@ -96,16 +97,16 @@ crate struct SharedContext<'tcx> {
/// The local file sources we've emitted and their respective url-paths.
crate local_sources: FxHashMap,
/// Whether the collapsed pass ran
- crate collapsed: bool,
+ collapsed: bool,
/// The base-URL of the issue tracker for when an item has been tagged with
/// an issue number.
- crate issue_tracker_base_url: Option,
+ issue_tracker_base_url: Option,
/// The directories that have already been created in this doc run. Used to reduce the number
/// of spurious `create_dir_all` calls.
- crate created_dirs: RefCell>,
+ created_dirs: RefCell>,
/// This flag indicates whether listings of modules (in the side bar and documentation itself)
/// should be ordered alphabetically or in order of appearance (in the source code).
- crate sort_modules_alphabetically: bool,
+ sort_modules_alphabetically: bool,
/// Additional CSS files to be added to the generated docs.
crate style_files: Vec,
/// Suffix to be added on resource files (if suffix is "-v2" then "light.css" becomes
@@ -118,7 +119,7 @@ crate struct SharedContext<'tcx> {
crate fs: DocFS,
/// The default edition used to parse doctests.
crate edition: Edition,
- crate codes: ErrorCodes,
+ codes: ErrorCodes,
playground: Option,
/// The map used to ensure all generated 'id=' attributes are unique.
id_map: RefCell,
@@ -128,11 +129,11 @@ crate struct SharedContext<'tcx> {
all: RefCell,
/// Storage for the errors produced while generating documentation so they
/// can be printed together at the end.
- crate errors: Receiver,
+ errors: Receiver,
/// `None` by default, depends on the `generate-redirect-map` option flag. If this field is set
/// to `Some(...)`, it'll store redirections and then generate a JSON file at the top level of
/// the crate.
- crate redirections: Option>>,
+ redirections: Option>>,
}
impl SharedContext<'_> {