1
Fork 0

rustdoc: Make a bunch of fields private

Also create issue for removing shared mutable state.
This commit is contained in:
Camelid 2021-02-21 14:35:15 -08:00
parent c4bb66c284
commit b3d2a371bb
2 changed files with 18 additions and 12 deletions

View file

@ -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<PathBuf, String>,
/// 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<String>,
issue_tracker_base_url: Option<String>,
/// 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<FxHashSet<PathBuf>>,
created_dirs: RefCell<FxHashSet<PathBuf>>,
/// 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<StylePath>,
/// 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<markdown::Playground>,
/// The map used to ensure all generated 'id=' attributes are unique.
id_map: RefCell<IdMap>,
@ -128,11 +129,11 @@ crate struct SharedContext<'tcx> {
all: RefCell<AllTypes>,
/// Storage for the errors produced while generating documentation so they
/// can be printed together at the end.
crate errors: Receiver<String>,
errors: Receiver<String>,
/// `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<RefCell<FxHashMap<String, String>>>,
redirections: Option<RefCell<FxHashMap<String, String>>>,
}
impl SharedContext<'_> {