diff --git a/src/librustdoc/clean/types.rs b/src/librustdoc/clean/types.rs index f0e6d4315648..861b70bac6c4 100644 --- a/src/librustdoc/clean/types.rs +++ b/src/librustdoc/clean/types.rs @@ -38,7 +38,6 @@ use crate::clean::Clean; use crate::core::DocContext; use crate::formats::cache::Cache; use crate::formats::item_type::ItemType; -use crate::html::render::search_index::ExternalLocation; use crate::html::render::Context; crate use self::FnRetTy::*; @@ -337,6 +336,16 @@ impl ExternalCrate { } } +/// Indicates where an external crate can be found. +crate enum ExternalLocation { + /// Remote URL root of the external crate + Remote(String), + /// This external crate can be found in the local doc/ folder + Local, + /// The external crate could not be found. + Unknown, +} + /// Anything with a source location and set of attributes and, optionally, a /// name. That is, anything that can be documented. This doesn't correspond /// directly to the AST's concept of an item; it's a strict superset. diff --git a/src/librustdoc/formats/cache.rs b/src/librustdoc/formats/cache.rs index 528d48a8d059..4dbf3b64a3d1 100644 --- a/src/librustdoc/formats/cache.rs +++ b/src/librustdoc/formats/cache.rs @@ -6,13 +6,13 @@ use rustc_middle::middle::privacy::AccessLevels; use rustc_middle::ty::TyCtxt; use rustc_span::symbol::sym; -use crate::clean::{self, ExternalCrate, ItemId, PrimitiveType}; +use crate::clean::{self, types::ExternalLocation, ExternalCrate, ItemId, PrimitiveType}; use crate::core::DocContext; use crate::fold::DocFolder; use crate::formats::item_type::ItemType; use crate::formats::Impl; use crate::html::markdown::short_markdown_summary; -use crate::html::render::search_index::{get_index_search_type, ExternalLocation}; +use crate::html::render::search_index::get_index_search_type; use crate::html::render::IndexItem; /// This cache is used to store information about the [`clean::Crate`] being diff --git a/src/librustdoc/html/format.rs b/src/librustdoc/html/format.rs index f7396f758b10..4088163df391 100644 --- a/src/librustdoc/html/format.rs +++ b/src/librustdoc/html/format.rs @@ -21,10 +21,12 @@ use rustc_middle::ty::TyCtxt; use rustc_span::def_id::CRATE_DEF_INDEX; use rustc_target::spec::abi::Abi; -use crate::clean::{self, utils::find_nearest_parent_module, ExternalCrate, ItemId, PrimitiveType}; +use crate::clean::{ + self, types::ExternalLocation, utils::find_nearest_parent_module, ExternalCrate, ItemId, + PrimitiveType, +}; use crate::formats::item_type::ItemType; use crate::html::escape::Escape; -use crate::html::render::search_index::ExternalLocation; use crate::html::render::Context; use super::url_parts_builder::UrlPartsBuilder; diff --git a/src/librustdoc/html/render/context.rs b/src/librustdoc/html/render/context.rs index 6729129027f5..534a542d58ed 100644 --- a/src/librustdoc/html/render/context.rs +++ b/src/librustdoc/html/render/context.rs @@ -14,7 +14,7 @@ use rustc_span::source_map::FileName; use rustc_span::symbol::sym; use super::print_item::{full_path, item_path, print_item}; -use super::search_index::{build_index, ExternalLocation}; +use super::search_index::build_index; use super::templates; use super::write_shared::write_shared; use super::{ @@ -22,7 +22,7 @@ use super::{ BASIC_KEYWORDS, }; -use crate::clean::{self, ExternalCrate}; +use crate::clean::{self, types::ExternalLocation, ExternalCrate}; use crate::config::RenderOptions; use crate::docfs::{DocFS, PathError}; use crate::error::Error; diff --git a/src/librustdoc/html/render/search_index.rs b/src/librustdoc/html/render/search_index.rs index 5d4df3ee5ff3..787f047790ae 100644 --- a/src/librustdoc/html/render/search_index.rs +++ b/src/librustdoc/html/render/search_index.rs @@ -13,16 +13,6 @@ use crate::formats::item_type::ItemType; use crate::html::markdown::short_markdown_summary; use crate::html::render::{IndexItem, IndexItemFunctionType, RenderType, TypeWithKind}; -/// Indicates where an external crate can be found. -crate enum ExternalLocation { - /// Remote URL root of the external crate - Remote(String), - /// This external crate can be found in the local doc/ folder - Local, - /// The external crate could not be found. - Unknown, -} - /// Builds the search index from the collected metadata crate fn build_index<'tcx>(krate: &clean::Crate, cache: &mut Cache, tcx: TyCtxt<'tcx>) -> String { let mut defid_to_pathid = FxHashMap::default(); diff --git a/src/librustdoc/json/mod.rs b/src/librustdoc/json/mod.rs index 01641bae3845..005da01b52b6 100644 --- a/src/librustdoc/json/mod.rs +++ b/src/librustdoc/json/mod.rs @@ -19,12 +19,11 @@ use rustc_session::Session; use rustdoc_json_types as types; use crate::clean; -use crate::clean::ExternalCrate; +use crate::clean::types::{ExternalCrate, ExternalLocation}; use crate::config::RenderOptions; use crate::error::Error; use crate::formats::cache::Cache; use crate::formats::FormatRenderer; -use crate::html::render::search_index::ExternalLocation; use crate::json::conversions::{from_item_id, IntoWithTcx}; #[derive(Clone)]