Skip to content

Commit 6a4396b

Browse files
committed
Extract Cache and other types from html module
1 parent 5bc9794 commit 6a4396b

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::*;
@@ -1172,7 +1173,7 @@ impl GetDefId for Type {
11721173
fn def_id(&self) -> Option<DefId> {
11731174
match *self {
11741175
ResolvedPath { did, .. } => Some(did),
1175-
Primitive(p) => crate::html::render::cache().primitive_locations.get(&p).cloned(),
1176+
Primitive(p) => cache().primitive_locations.get(&p).cloned(),
11761177
BorrowedRef { type_: box Generic(..), .. } => {
11771178
Primitive(PrimitiveType::Reference).def_id()
11781179
}

src/librustdoc/config.rs

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

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

src/librustdoc/core.rs

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

0 commit comments

Comments
 (0)