Skip to content

Commit

Permalink
Rollup merge of #138041 - thaliaarchi:use-prelude-size-of.boostrap-co…
Browse files Browse the repository at this point in the history
…mpiletest, 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``
  • Loading branch information
compiler-errors authored Mar 6, 2025
2 parents 234a68f + c85d3f6 commit 65b5a23
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/bootstrap/src/bin/rustc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
4 changes: 2 additions & 2 deletions src/bootstrap/src/utils/job.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::{
Expand Down Expand Up @@ -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());

Expand Down
1 change: 0 additions & 1 deletion src/tools/compiletest/src/raise_fd_limit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down

0 comments on commit 65b5a23

Please sign in to comment.