diff options
| author | ismailarilik <arilik.ismail@gmail.com> | 2024-10-06 10:39:03 +0300 |
|---|---|---|
| committer | ismailarilik <arilik.ismail@gmail.com> | 2024-10-06 10:39:03 +0300 |
| commit | e0a20b484d0b88183ddd46b82aa47d7bbfe48468 (patch) | |
| tree | d51f1e856c1054347a3da443d9a714c604543f11 /src/librustdoc/html/render | |
| parent | 85e2f55d8291e643b5b4c98ee09db301379d63a6 (diff) | |
| download | rust-e0a20b484d0b88183ddd46b82aa47d7bbfe48468.tar.gz rust-e0a20b484d0b88183ddd46b82aa47d7bbfe48468.zip | |
Handle `librustdoc` cases of `rustc::potential_query_instability` lint
Diffstat (limited to 'src/librustdoc/html/render')
| -rw-r--r-- | src/librustdoc/html/render/context.rs | 14 | ||||
| -rw-r--r-- | src/librustdoc/html/render/mod.rs | 38 | ||||
| -rw-r--r-- | src/librustdoc/html/render/print_item.rs | 4 | ||||
| -rw-r--r-- | src/librustdoc/html/render/search_index.rs | 10 | ||||
| -rw-r--r-- | src/librustdoc/html/render/span_map.rs | 4 | ||||
| -rw-r--r-- | src/librustdoc/html/render/write_shared.rs | 10 |
6 files changed, 40 insertions, 40 deletions
diff --git a/src/librustdoc/html/render/context.rs b/src/librustdoc/html/render/context.rs index bce3f218908..dc4d45e592e 100644 --- a/src/librustdoc/html/render/context.rs +++ b/src/librustdoc/html/render/context.rs @@ -6,7 +6,7 @@ use std::rc::Rc; use std::sync::mpsc::{Receiver, channel}; use rinja::Template; -use rustc_data_structures::fx::{FxHashMap, FxHashSet}; +use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexMap, FxIndexSet}; use rustc_hir::def_id::{DefIdMap, LOCAL_CRATE}; use rustc_middle::ty::TyCtxt; use rustc_session::Session; @@ -69,16 +69,16 @@ pub(crate) struct Context<'tcx> { /// `true`. pub(crate) include_sources: bool, /// Collection of all types with notable traits referenced in the current module. - pub(crate) types_with_notable_traits: FxHashSet<clean::Type>, + pub(crate) types_with_notable_traits: FxIndexSet<clean::Type>, /// Field used during rendering, to know if we're inside an inlined item. pub(crate) is_inside_inlined_module: bool, } // `Context` is cloned a lot, so we don't want the size to grow unexpectedly. #[cfg(all(not(windows), target_pointer_width = "64"))] -rustc_data_structures::static_assert_size!(Context<'_>, 160); +rustc_data_structures::static_assert_size!(Context<'_>, 184); #[cfg(all(windows, target_pointer_width = "64"))] -rustc_data_structures::static_assert_size!(Context<'_>, 168); +rustc_data_structures::static_assert_size!(Context<'_>, 192); /// Shared mutable state used in [`Context`] and elsewhere. pub(crate) struct SharedContext<'tcx> { @@ -90,7 +90,7 @@ pub(crate) struct SharedContext<'tcx> { /// creation of the context (contains info like the favicon and added html). pub(crate) layout: layout::Layout, /// The local file sources we've emitted and their respective url-paths. - pub(crate) local_sources: FxHashMap<PathBuf, String>, + pub(crate) local_sources: FxIndexMap<PathBuf, String>, /// Show the memory layout of types in the docs. pub(super) show_type_layout: bool, /// The base-URL of the issue tracker for when an item has been tagged with @@ -567,7 +567,7 @@ impl<'tcx> FormatRenderer<'tcx> for Context<'tcx> { deref_id_map: Default::default(), shared: Rc::new(scx), include_sources, - types_with_notable_traits: FxHashSet::default(), + types_with_notable_traits: FxIndexSet::default(), is_inside_inlined_module: false, }; @@ -591,7 +591,7 @@ impl<'tcx> FormatRenderer<'tcx> for Context<'tcx> { id_map: IdMap::new(), shared: Rc::clone(&self.shared), include_sources: self.include_sources, - types_with_notable_traits: FxHashSet::default(), + types_with_notable_traits: FxIndexSet::default(), is_inside_inlined_module: self.is_inside_inlined_module, } } diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs index 227df0c5f39..399730a01c8 100644 --- a/src/librustdoc/html/render/mod.rs +++ b/src/librustdoc/html/render/mod.rs @@ -47,7 +47,7 @@ use std::{fs, str}; use rinja::Template; use rustc_attr::{ConstStability, DeprecatedSince, Deprecation, StabilityLevel, StableSince}; use rustc_data_structures::captures::Captures; -use rustc_data_structures::fx::{FxHashMap, FxHashSet}; +use rustc_data_structures::fx::{FxHashSet, FxIndexMap, FxIndexSet}; use rustc_hir::Mutability; use rustc_hir::def_id::{DefId, DefIdSet}; use rustc_middle::ty::print::PrintTraitRefExt; @@ -328,24 +328,24 @@ impl Ord for ItemEntry { #[derive(Debug)] struct AllTypes { - structs: FxHashSet<ItemEntry>, - enums: FxHashSet<ItemEntry>, - unions: FxHashSet<ItemEntry>, - primitives: FxHashSet<ItemEntry>, - traits: FxHashSet<ItemEntry>, - macros: FxHashSet<ItemEntry>, - functions: FxHashSet<ItemEntry>, - type_aliases: FxHashSet<ItemEntry>, - statics: FxHashSet<ItemEntry>, - constants: FxHashSet<ItemEntry>, - attribute_macros: FxHashSet<ItemEntry>, - derive_macros: FxHashSet<ItemEntry>, - trait_aliases: FxHashSet<ItemEntry>, + structs: FxIndexSet<ItemEntry>, + enums: FxIndexSet<ItemEntry>, + unions: FxIndexSet<ItemEntry>, + primitives: FxIndexSet<ItemEntry>, + traits: FxIndexSet<ItemEntry>, + macros: FxIndexSet<ItemEntry>, + functions: FxIndexSet<ItemEntry>, + type_aliases: FxIndexSet<ItemEntry>, + statics: FxIndexSet<ItemEntry>, + constants: FxIndexSet<ItemEntry>, + attribute_macros: FxIndexSet<ItemEntry>, + derive_macros: FxIndexSet<ItemEntry>, + trait_aliases: FxIndexSet<ItemEntry>, } impl AllTypes { fn new() -> AllTypes { - let new_set = |cap| FxHashSet::with_capacity_and_hasher(cap, Default::default()); + let new_set = |cap| FxIndexSet::with_capacity_and_hasher(cap, Default::default()); AllTypes { structs: new_set(100), enums: new_set(100), @@ -437,7 +437,7 @@ impl AllTypes { } fn print(self, f: &mut Buffer) { - fn print_entries(f: &mut Buffer, e: &FxHashSet<ItemEntry>, kind: ItemSection) { + fn print_entries(f: &mut Buffer, e: &FxIndexSet<ItemEntry>, kind: ItemSection) { if !e.is_empty() { let mut e: Vec<&ItemEntry> = e.iter().collect(); e.sort(); @@ -1151,7 +1151,7 @@ fn render_attributes_in_code(w: &mut impl fmt::Write, it: &clean::Item, cx: &Con #[derive(Copy, Clone)] enum AssocItemLink<'a> { Anchor(Option<&'a str>), - GotoSource(ItemId, &'a FxHashSet<Symbol>), + GotoSource(ItemId, &'a FxIndexSet<Symbol>), } impl<'a> AssocItemLink<'a> { @@ -1494,7 +1494,7 @@ fn notable_traits_decl(ty: &clean::Type, cx: &Context<'_>) -> (String, String) { for it in &impl_.items { if let clean::AssocTypeItem(ref tydef, ref _bounds) = it.kind { out.push_str("<div class=\"where\"> "); - let empty_set = FxHashSet::default(); + let empty_set = FxIndexSet::default(); let src_link = AssocItemLink::GotoSource(trait_did.into(), &empty_set); assoc_type( &mut out, @@ -2526,7 +2526,7 @@ fn render_call_locations<W: fmt::Write>(mut w: W, cx: &mut Context<'_>, item: &c })() .unwrap_or(DUMMY_SP); - let mut decoration_info = FxHashMap::default(); + let mut decoration_info = FxIndexMap::default(); decoration_info.insert("highlight focus", vec![byte_ranges.remove(0)]); decoration_info.insert("highlight", byte_ranges); diff --git a/src/librustdoc/html/render/print_item.rs b/src/librustdoc/html/render/print_item.rs index 38276e4d20c..3c96f873681 100644 --- a/src/librustdoc/html/render/print_item.rs +++ b/src/librustdoc/html/render/print_item.rs @@ -6,7 +6,7 @@ use std::rc::Rc; use itertools::Itertools; use rinja::Template; use rustc_data_structures::captures::Captures; -use rustc_data_structures::fx::{FxHashMap, FxHashSet}; +use rustc_data_structures::fx::{FxHashMap, FxIndexSet}; use rustc_hir as hir; use rustc_hir::def::CtorKind; use rustc_hir::def_id::DefId; @@ -932,7 +932,7 @@ fn item_trait(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, t: &clean: let cloned_shared = Rc::clone(&cx.shared); let cache = &cloned_shared.cache; - let mut extern_crates = FxHashSet::default(); + let mut extern_crates = FxIndexSet::default(); if !t.is_object_safe(cx.tcx()) { write_section_heading( diff --git a/src/librustdoc/html/render/search_index.rs b/src/librustdoc/html/render/search_index.rs index 660ca3b2594..c958458b662 100644 --- a/src/librustdoc/html/render/search_index.rs +++ b/src/librustdoc/html/render/search_index.rs @@ -774,7 +774,7 @@ pub(crate) fn get_function_type_for_search<'tcx>( fn get_index_type( clean_type: &clean::Type, generics: Vec<RenderType>, - rgen: &mut FxHashMap<SimplifiedParam, (isize, Vec<RenderType>)>, + rgen: &mut FxIndexMap<SimplifiedParam, (isize, Vec<RenderType>)>, ) -> RenderType { RenderType { id: get_index_type_id(clean_type, rgen), @@ -785,7 +785,7 @@ fn get_index_type( fn get_index_type_id( clean_type: &clean::Type, - rgen: &mut FxHashMap<SimplifiedParam, (isize, Vec<RenderType>)>, + rgen: &mut FxIndexMap<SimplifiedParam, (isize, Vec<RenderType>)>, ) -> Option<RenderTypeId> { use rustc_hir::def::{DefKind, Res}; match *clean_type { @@ -854,7 +854,7 @@ fn simplify_fn_type<'a, 'tcx>( tcx: TyCtxt<'tcx>, recurse: usize, res: &mut Vec<RenderType>, - rgen: &mut FxHashMap<SimplifiedParam, (isize, Vec<RenderType>)>, + rgen: &mut FxIndexMap<SimplifiedParam, (isize, Vec<RenderType>)>, is_return: bool, cache: &Cache, ) { @@ -1198,7 +1198,7 @@ fn simplify_fn_constraint<'a, 'tcx>( tcx: TyCtxt<'tcx>, recurse: usize, res: &mut Vec<(RenderTypeId, Vec<RenderType>)>, - rgen: &mut FxHashMap<SimplifiedParam, (isize, Vec<RenderType>)>, + rgen: &mut FxIndexMap<SimplifiedParam, (isize, Vec<RenderType>)>, is_return: bool, cache: &Cache, ) { @@ -1285,7 +1285,7 @@ fn get_fn_inputs_and_outputs<'tcx>( ) -> (Vec<RenderType>, Vec<RenderType>, Vec<Vec<RenderType>>) { let decl = &func.decl; - let mut rgen: FxHashMap<SimplifiedParam, (isize, Vec<RenderType>)> = Default::default(); + let mut rgen: FxIndexMap<SimplifiedParam, (isize, Vec<RenderType>)> = Default::default(); let combined_generics; let (self_, generics) = if let Some((impl_self, impl_generics)) = impl_or_trait_generics { diff --git a/src/librustdoc/html/render/span_map.rs b/src/librustdoc/html/render/span_map.rs index 7e1ea5cde83..b314b060368 100644 --- a/src/librustdoc/html/render/span_map.rs +++ b/src/librustdoc/html/render/span_map.rs @@ -1,6 +1,6 @@ use std::path::{Path, PathBuf}; -use rustc_data_structures::fx::FxHashMap; +use rustc_data_structures::fx::{FxHashMap, FxIndexMap}; use rustc_hir::def::{DefKind, Res}; use rustc_hir::def_id::{DefId, LOCAL_CRATE}; use rustc_hir::intravisit::{self, Visitor}; @@ -44,7 +44,7 @@ pub(crate) fn collect_spans_and_sources( src_root: &Path, include_sources: bool, generate_link_to_definition: bool, -) -> (FxHashMap<PathBuf, String>, FxHashMap<Span, LinkFromSrc>) { +) -> (FxIndexMap<PathBuf, String>, FxHashMap<Span, LinkFromSrc>) { let mut visitor = SpanMapVisitor { tcx, matches: FxHashMap::default() }; if include_sources { diff --git a/src/librustdoc/html/render/write_shared.rs b/src/librustdoc/html/render/write_shared.rs index af94b1042c0..12b63460056 100644 --- a/src/librustdoc/html/render/write_shared.rs +++ b/src/librustdoc/html/render/write_shared.rs @@ -28,7 +28,7 @@ use indexmap::IndexMap; use itertools::Itertools; use regex::Regex; use rustc_data_structures::flock; -use rustc_data_structures::fx::{FxHashMap, FxHashSet}; +use rustc_data_structures::fx::{FxHashSet, FxIndexMap, FxIndexSet}; use rustc_middle::ty::TyCtxt; use rustc_middle::ty::fast_reject::DeepRejectCtxt; use rustc_span::Symbol; @@ -505,8 +505,8 @@ createSrcSidebar();", struct Hierarchy { parent: Weak<Self>, elem: OsString, - children: RefCell<FxHashMap<OsString, Rc<Self>>>, - elems: RefCell<FxHashSet<OsString>>, + children: RefCell<FxIndexMap<OsString, Rc<Self>>>, + elems: RefCell<FxIndexSet<OsString>>, } impl Hierarchy { @@ -961,8 +961,8 @@ impl Serialize for AliasSerializableImpl { fn get_path_parts<T: CciPart>( dst: &Path, crates_info: &[CrateInfo], -) -> FxHashMap<PathBuf, Vec<String>> { - let mut templates: FxHashMap<PathBuf, Vec<String>> = FxHashMap::default(); +) -> FxIndexMap<PathBuf, Vec<String>> { + let mut templates: FxIndexMap<PathBuf, Vec<String>> = FxIndexMap::default(); crates_info .iter() .map(|crate_info| T::from_crate_info(crate_info).parts.iter()) |
