Skip to content

Commit d6028e2

Browse files
committed
compiletest: update to Edition 2024
1 parent 934880f commit d6028e2

File tree

4 files changed

+17
-10
lines changed

4 files changed

+17
-10
lines changed

src/tools/compiletest/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "compiletest"
33
version = "0.0.0"
4-
edition = "2021"
4+
edition = "2024"
55

66
[lib]
77
doctest = false

src/tools/compiletest/src/debuggers.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ pub(crate) fn configure_gdb(config: &Config) -> Option<Arc<Config>> {
4040
//
4141
// we should figure out how to lift this restriction! (run them all
4242
// on different ports allocated dynamically).
43-
env::set_var("RUST_TEST_THREADS", "1");
43+
//
44+
// SAFETY: at this point we are still single-threaded.
45+
unsafe { env::set_var("RUST_TEST_THREADS", "1") };
4446
}
4547

4648
Some(Arc::new(Config { debugger: Some(Debugger::Gdb), ..config.clone() }))

src/tools/compiletest/src/lib.rs

+8-4
Original file line numberDiff line numberDiff line change
@@ -529,10 +529,14 @@ pub fn run_tests(config: Arc<Config>) {
529529
}
530530
// Prevent issue #21352 UAC blocking .exe containing 'patch' etc. on Windows
531531
// If #11207 is resolved (adding manifest to .exe) this becomes unnecessary
532-
env::set_var("__COMPAT_LAYER", "RunAsInvoker");
533-
534-
// Let tests know which target they're running as
535-
env::set_var("TARGET", &config.target);
532+
//
533+
// SAFETY: at this point we're still single-threaded.
534+
unsafe { env::set_var("__COMPAT_LAYER", "RunAsInvoker") };
535+
536+
// Let tests know which target they're running as.
537+
//
538+
// SAFETY: at this point we're still single-threaded.
539+
unsafe { env::set_var("TARGET", &config.target) };
536540

537541
let mut configs = Vec::new();
538542
if let Mode::DebugInfo = config.mode {

src/tools/compiletest/src/raise_fd_limit.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,17 @@ pub unsafe fn raise_fd_limit() {
2121
let mut mib: [libc::c_int; 2] = [CTL_KERN, KERN_MAXFILESPERPROC];
2222
let mut maxfiles: libc::c_int = 0;
2323
let mut size: libc::size_t = size_of_val(&maxfiles) as libc::size_t;
24-
if libc::sysctl(&mut mib[0], 2, &mut maxfiles as *mut _ as *mut _, &mut size, null_mut(), 0)
25-
!= 0
24+
if unsafe {
25+
libc::sysctl(&mut mib[0], 2, &mut maxfiles as *mut _ as *mut _, &mut size, null_mut(), 0)
26+
} != 0
2627
{
2728
let err = io::Error::last_os_error();
2829
panic!("raise_fd_limit: error calling sysctl: {}", err);
2930
}
3031

3132
// Fetch the current resource limits
3233
let mut rlim = libc::rlimit { rlim_cur: 0, rlim_max: 0 };
33-
if libc::getrlimit(libc::RLIMIT_NOFILE, &mut rlim) != 0 {
34+
if unsafe { libc::getrlimit(libc::RLIMIT_NOFILE, &mut rlim) } != 0 {
3435
let err = io::Error::last_os_error();
3536
panic!("raise_fd_limit: error calling getrlimit: {}", err);
3637
}
@@ -41,7 +42,7 @@ pub unsafe fn raise_fd_limit() {
4142
rlim.rlim_cur = cmp::min(maxfiles as libc::rlim_t, rlim.rlim_max);
4243

4344
// Set our newly-increased resource limit.
44-
if libc::setrlimit(libc::RLIMIT_NOFILE, &rlim) != 0 {
45+
if unsafe { libc::setrlimit(libc::RLIMIT_NOFILE, &rlim) } != 0 {
4546
let err = io::Error::last_os_error();
4647
panic!("raise_fd_limit: error calling setrlimit: {}", err);
4748
}

0 commit comments

Comments
 (0)