about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2025-03-06 15:40:01 -0500
committerGitHub <noreply@github.com>2025-03-06 15:40:01 -0500
commit65b5a2398aed37a6efd4415a52cb4400d3efb412 (patch)
tree64647cb79298e4b6b7cdf8a5b96c64ecc292c41c
parent234a68f06fe9a4022f0ed0b13034274b9304bdf8 (diff)
parentc85d3f6e874acd35647617161fd2ae950b94dedd (diff)
downloadrust-65b5a2398aed37a6efd4415a52cb4400d3efb412.tar.gz
rust-65b5a2398aed37a6efd4415a52cb4400d3efb412.zip
Rollup merge of #138041 - thaliaarchi:use-prelude-size-of.boostrap-compiletest, r=jieyouxu
bootstrap and compiletest: Use `size_of_val` from the prelude instead of imported

Use `std::mem::size_of_val` from the prelude instead of importing or qualifying it.

This function was added to all preludes in Rust 1.80.

r? ``@jieyouxu``
-rw-r--r--src/bootstrap/src/bin/rustc.rs2
-rw-r--r--src/bootstrap/src/utils/job.rs4
-rw-r--r--src/tools/compiletest/src/raise_fd_limit.rs1
3 files changed, 3 insertions, 4 deletions
diff --git a/src/bootstrap/src/bin/rustc.rs b/src/bootstrap/src/bin/rustc.rs
index 61045067592..d8cae02456c 100644
--- a/src/bootstrap/src/bin/rustc.rs
+++ b/src/bootstrap/src/bin/rustc.rs
@@ -349,7 +349,7 @@ fn format_rusage_data(child: Child) -> Option<String> {
     let mut kernel_filetime = Default::default();
     let mut kernel_time = Default::default();
     let mut memory_counters = PROCESS_MEMORY_COUNTERS::default();
-    let memory_counters_size = std::mem::size_of_val(&memory_counters);
+    let memory_counters_size = size_of_val(&memory_counters);
 
     unsafe {
         GetProcessTimes(
diff --git a/src/bootstrap/src/utils/job.rs b/src/bootstrap/src/utils/job.rs
index 10efed130d6..a60e889fd57 100644
--- a/src/bootstrap/src/utils/job.rs
+++ b/src/bootstrap/src/utils/job.rs
@@ -42,7 +42,7 @@ pub unsafe fn setup(build: &mut crate::Build) {
 #[cfg(windows)]
 mod for_windows {
     use std::ffi::c_void;
-    use std::{io, mem};
+    use std::io;
 
     use windows::Win32::Foundation::CloseHandle;
     use windows::Win32::System::Diagnostics::Debug::{
@@ -82,7 +82,7 @@ mod for_windows {
             job,
             JobObjectExtendedLimitInformation,
             &info as *const _ as *const c_void,
-            mem::size_of_val(&info) as u32,
+            size_of_val(&info) as u32,
         );
         assert!(r.is_ok(), "{}", io::Error::last_os_error());
 
diff --git a/src/tools/compiletest/src/raise_fd_limit.rs b/src/tools/compiletest/src/raise_fd_limit.rs
index 4445ecb7ce8..7b12ba946b9 100644
--- a/src/tools/compiletest/src/raise_fd_limit.rs
+++ b/src/tools/compiletest/src/raise_fd_limit.rs
@@ -7,7 +7,6 @@
 #[cfg(target_vendor = "apple")]
 #[allow(non_camel_case_types)]
 pub unsafe fn raise_fd_limit() {
-    use std::mem::size_of_val;
     use std::ptr::null_mut;
     use std::{cmp, io};