Skip to content

Commit d00c047

Browse files
Rollup merge of #155533 - ChayimFriedman2:const-cache-new, r=ShoyuVanilla
Provide a const new for `GlobalCache` This can help rust-analyzer a bit.
2 parents 2e5a9fc + 5749fe8 commit d00c047

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

compiler/rustc_type_ir/src/search_graph/global_cache.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ pub struct GlobalCache<X: Cx> {
3939
}
4040

4141
impl<X: Cx> GlobalCache<X> {
42+
#[inline]
43+
pub const fn new() -> Self {
44+
GlobalCache { map: HashMap::with_hasher(rustc_hash::FxBuildHasher) }
45+
}
46+
4247
/// Insert a final result into the global cache.
4348
pub(super) fn insert(
4449
&mut self,

0 commit comments

Comments
 (0)