Skip to content

Commit a8e4c68

Browse files
committed
Auto merge of #141270 - Zalathar:rollup-jd1y1f6, r=Zalathar
Rollup of 5 pull requests Successful merges: - #141211 (Replace `try_reserve_exact` with `try_with_capacity` in `std::fs::read`) - #141257 (trim cache module in utils bootstrap) - #141259 (Update books) - #141261 (current_dll_path: fix mistake in assertion message) - #141262 (Properly remove Noratrieb from review rotation) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 60dabef + 4a47234 commit a8e4c68

File tree

8 files changed

+5
-59
lines changed

8 files changed

+5
-59
lines changed

compiler/rustc_session/src/filesearch.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ fn current_dll_path() -> Result<PathBuf, String> {
8282
let fname_ptr = info.dli_fname.as_ptr();
8383
#[cfg(not(target_os = "cygwin"))]
8484
let fname_ptr = {
85-
assert!(!info.dli_fname.is_null(), "the docs do not allow dladdr to be null");
85+
assert!(!info.dli_fname.is_null(), "dli_fname cannot be null");
8686
info.dli_fname
8787
};
8888
let bytes = CStr::from_ptr(fname_ptr).to_bytes();

library/std/src/fs.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,8 +285,7 @@ pub fn read<P: AsRef<Path>>(path: P) -> io::Result<Vec<u8>> {
285285
fn inner(path: &Path) -> io::Result<Vec<u8>> {
286286
let mut file = File::open(path)?;
287287
let size = file.metadata().map(|m| m.len() as usize).ok();
288-
let mut bytes = Vec::new();
289-
bytes.try_reserve_exact(size.unwrap_or(0))?;
288+
let mut bytes = Vec::try_with_capacity(size.unwrap_or(0))?;
290289
io::default_read_to_end(&mut file, &mut bytes, size)?;
291290
Ok(bytes)
292291
}

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");

src/doc/book

Submodule book updated 29 files

triagebot.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1171,7 +1171,6 @@ contributing_url = "https://rustc-dev-guide.rust-lang.org/getting-started.html"
11711171
users_on_vacation = [
11721172
"fmease",
11731173
"jyn514",
1174-
"Noratrieb",
11751174
"spastorino",
11761175
]
11771176

@@ -1198,15 +1197,13 @@ compiler = [
11981197
"@lcnr",
11991198
"@Nadrieril",
12001199
"@nnethercote",
1201-
"@Noratrieb",
12021200
"@oli-obk",
12031201
"@petrochenkov",
12041202
"@SparrowLii",
12051203
"@wesleywiser",
12061204
]
12071205
libs = [
12081206
"@Mark-Simulacrum",
1209-
"@Noratrieb",
12101207
"@workingjubilee",
12111208
"@joboet",
12121209
"@jhpratt",

0 commit comments

Comments
 (0)