Skip to content

Commit 5897dc2

Browse files
authored
Unrolled build for rust-lang#141257
Rollup merge of rust-lang#141257 - Shourya742:2025-05-19-trim-cache-module, r=onur-ozkan trim cache module in utils bootstrap We don't use other variants of Interner in bootstrap, so this PR streamlines the bootstrap cache utils module. r? `@onur-ozkan`
2 parents 60dabef + 8ecb128 commit 5897dc2

File tree

2 files changed

+0
-50
lines changed

2 files changed

+0
-50
lines changed

src/bootstrap/src/utils/cache.rs

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ use std::collections::HashMap;
2020
use std::hash::{Hash, Hasher};
2121
use std::marker::PhantomData;
2222
use std::ops::Deref;
23-
use std::path::PathBuf;
2423
use std::sync::{LazyLock, Mutex};
2524
use std::{fmt, mem};
2625

@@ -51,26 +50,11 @@ impl<T> PartialEq for Interned<T> {
5150
}
5251
impl<T> Eq for Interned<T> {}
5352

54-
impl PartialEq<str> for Interned<String> {
55-
fn eq(&self, other: &str) -> bool {
56-
*self == other
57-
}
58-
}
5953
impl PartialEq<&str> for Interned<String> {
6054
fn eq(&self, other: &&str) -> bool {
6155
**self == **other
6256
}
6357
}
64-
impl<T> PartialEq<&Interned<T>> for Interned<T> {
65-
fn eq(&self, other: &&Self) -> bool {
66-
self.0 == other.0
67-
}
68-
}
69-
impl<T> PartialEq<Interned<T>> for &Interned<T> {
70-
fn eq(&self, other: &Interned<T>) -> bool {
71-
self.0 == other.0
72-
}
73-
}
7458

7559
unsafe impl<T> Send for Interned<T> {}
7660
unsafe impl<T> Sync for Interned<T> {}
@@ -188,8 +172,6 @@ impl<T: Hash + Clone + Eq> TyIntern<T> {
188172
#[derive(Default)]
189173
pub struct Interner {
190174
strs: Mutex<TyIntern<String>>,
191-
paths: Mutex<TyIntern<PathBuf>>,
192-
lists: Mutex<TyIntern<Vec<String>>>,
193175
}
194176

195177
/// Defines the behavior required for a type to be internable.
@@ -210,18 +192,6 @@ impl Internable for String {
210192
}
211193
}
212194

213-
impl Internable for PathBuf {
214-
fn intern_cache() -> &'static Mutex<TyIntern<Self>> {
215-
&INTERNER.paths
216-
}
217-
}
218-
219-
impl Internable for Vec<String> {
220-
fn intern_cache() -> &'static Mutex<TyIntern<Self>> {
221-
&INTERNER.lists
222-
}
223-
}
224-
225195
impl Interner {
226196
/// Interns a string reference, ensuring it is stored uniquely.
227197
///

src/bootstrap/src/utils/cache/tests.rs

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,6 @@ fn test_string_interning() {
1212
assert_ne!(s1, s3, "Different strings should have different interned values");
1313
}
1414

15-
#[test]
16-
fn test_path_interning() {
17-
let p1 = PathBuf::from("/tmp/file").intern();
18-
let p2 = PathBuf::from("/tmp/file").intern();
19-
let p3 = PathBuf::from("/tmp/other").intern();
20-
21-
assert_eq!(p1, p2);
22-
assert_ne!(p1, p3);
23-
}
24-
25-
#[test]
26-
fn test_vec_interning() {
27-
let v1 = vec!["a".to_string(), "b".to_string()].intern();
28-
let v2 = vec!["a".to_string(), "b".to_string()].intern();
29-
let v3 = vec!["c".to_string()].intern();
30-
31-
assert_eq!(v1, v2);
32-
assert_ne!(v1, v3);
33-
}
34-
3515
#[test]
3616
fn test_interned_equality() {
3717
let s1 = INTERNER.intern_str("test");

0 commit comments

Comments
 (0)