Skip to content

Commit f3f748e

Browse files
committed
Extract Cache and other types from html module
1 parent 41fc4d9 commit f3f748e

File tree

12 files changed

+808
-752
lines changed

12 files changed

+808
-752
lines changed

src/librustdoc/clean/types.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,9 @@ use crate::clean::inline;
3232
use crate::clean::types::Type::{QPath, ResolvedPath};
3333
use crate::core::DocContext;
3434
use crate::doctree;
35-
use crate::html::item_type::ItemType;
36-
use crate::html::render::{cache, ExternalLocation};
35+
use crate::formats::cache::cache;
36+
use crate::formats::item_type::ItemType;
37+
use crate::html::render::cache::ExternalLocation;
3738

3839
use self::FnRetTy::*;
3940
use self::ItemEnum::*;
@@ -1204,7 +1205,7 @@ impl GetDefId for Type {
12041205
fn def_id(&self) -> Option<DefId> {
12051206
match *self {
12061207
ResolvedPath { did, .. } => Some(did),
1207-
Primitive(p) => crate::html::render::cache().primitive_locations.get(&p).cloned(),
1208+
Primitive(p) => cache().primitive_locations.get(&p).cloned(),
12081209
BorrowedRef { type_: box Generic(..), .. } => {
12091210
Primitive(PrimitiveType::Reference).def_id()
12101211
}

src/librustdoc/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ pub struct RenderOptions {
255255

256256
/// Temporary storage for data obtained during `RustdocVisitor::clean()`.
257257
/// Later on moved into `CACHE_KEY`.
258-
#[derive(Default)]
258+
#[derive(Default, Clone)]
259259
pub struct RenderInfo {
260260
pub inlined: FxHashSet<DefId>,
261261
pub external_paths: crate::core::ExternalPaths,

src/librustdoc/core.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ pub type ExternalPaths = FxHashMap<DefId, (Vec<String>, clean::TypeKind)>;
3939
pub struct DocContext<'tcx> {
4040
pub tcx: TyCtxt<'tcx>,
4141
pub resolver: Rc<RefCell<interface::BoxedResolver>>,
42-
/// Later on moved into `html::render::CACHE_KEY`
42+
/// Later on moved into `formats::cache::CACHE_KEY`
4343
pub renderinfo: RefCell<RenderInfo>,
44-
/// Later on moved through `clean::Crate` into `html::render::CACHE_KEY`
44+
/// Later on moved through `clean::Crate` into `formats::cache::CACHE_KEY`
4545
pub external_traits: Rc<RefCell<FxHashMap<DefId, clean::Trait>>>,
4646
/// Used while populating `external_traits` to ensure we don't process the same trait twice at
4747
/// the same time.

0 commit comments

Comments
 (0)