Skip to content

Commit c872c14

Browse files
authored
Turbopack: Inline uses of the SliceMap type alias (#87122)
- We (@lukesandberg, @sokra, and myself) discussed this type alias during the team meeting on Thursday and decided the alias wasn't worth it. Apparently I left a comment to the effect when this was first added: #76053 (comment) - Now that [`FrozenMap`](https://turbopack-rust-docs.vercel.sh/rustdoc/turbo_frozenmap/map/struct.FrozenMap.html) exists, we want people to gravitate towards that type instead of `SliceMap`. - I tried replacing these uses with `FrozenMap` in #87050, but it turns out that we do care a lot about iteration order for these types.
1 parent d241552 commit c872c14

File tree

2 files changed

+4
-6
lines changed
  • turbopack/crates

2 files changed

+4
-6
lines changed

turbopack/crates/turbo-tasks/src/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,6 @@ pub use crate::{
138138
},
139139
};
140140

141-
pub type SliceMap<K, V> = Box<[(K, V)]>;
142-
143141
pub type FxIndexSet<T> = indexmap::IndexSet<T, BuildHasherDefault<FxHasher>>;
144142
pub type FxIndexMap<K, V> = indexmap::IndexMap<K, V, BuildHasherDefault<FxHasher>>;
145143
pub type FxDashMap<K, V> = dashmap::DashMap<K, V, BuildHasherDefault<FxHasher>>;

turbopack/crates/turbopack-core/src/resolve/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ use tracing::{Instrument, Level};
1717
use turbo_frozenmap::{FrozenMap, FrozenSet};
1818
use turbo_rcstr::{RcStr, rcstr};
1919
use turbo_tasks::{
20-
FxIndexMap, FxIndexSet, NonLocalValue, ReadRef, ResolvedVc, SliceMap, TaskInput,
21-
TryFlatJoinIterExt, TryJoinIterExt, ValueToString, Vc, trace::TraceRawVcs,
20+
FxIndexMap, FxIndexSet, NonLocalValue, ReadRef, ResolvedVc, TaskInput, TryFlatJoinIterExt,
21+
TryJoinIterExt, ValueToString, Vc, trace::TraceRawVcs,
2222
};
2323
use turbo_tasks_fs::{FileSystemEntryType, FileSystemPath};
2424
use turbo_unix_path::normalize_request;
@@ -173,7 +173,7 @@ impl ExportUsage {
173173
#[turbo_tasks::value(shared)]
174174
#[derive(Clone, Debug)]
175175
pub struct ModuleResolveResult {
176-
pub primary: SliceMap<RequestKey, ModuleResolveResultItem>,
176+
pub primary: Box<[(RequestKey, ModuleResolveResultItem)]>,
177177
/// Affecting sources are other files that influence the resolve result. For example,
178178
/// traversed symlinks
179179
pub affecting_sources: Box<[ResolvedVc<Box<dyn Source>>]>,
@@ -513,7 +513,7 @@ impl RequestKey {
513513
#[turbo_tasks::value(shared)]
514514
#[derive(Clone)]
515515
pub struct ResolveResult {
516-
pub primary: SliceMap<RequestKey, ResolveResultItem>,
516+
pub primary: Box<[(RequestKey, ResolveResultItem)]>,
517517
/// Affecting sources are other files that influence the resolve result. For example,
518518
/// traversed symlinks
519519
pub affecting_sources: Box<[ResolvedVc<Box<dyn Source>>]>,

0 commit comments

Comments
 (0)