From 2f84c7610f41fd6f1b448b947e9643ca7b513649 Mon Sep 17 00:00:00 2001 From: WANG Rui Date: Mon, 11 Mar 2024 11:28:34 +0800 Subject: [PATCH 01/11] configure.py: add flag for loongarch64 musl-root --- src/bootstrap/configure.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/bootstrap/configure.py b/src/bootstrap/configure.py index 4257c0f7991a6..fa46631906206 100755 --- a/src/bootstrap/configure.py +++ b/src/bootstrap/configure.py @@ -130,6 +130,8 @@ def v(*args): "riscv32gc-unknown-linux-musl install directory") v("musl-root-riscv64gc", "target.riscv64gc-unknown-linux-musl.musl-root", "riscv64gc-unknown-linux-musl install directory") +v("musl-root-loongarch64", "target.loongarch64-unknown-linux-musl.musl-root", + "loongarch64-unknown-linux-musl install directory") v("qemu-armhf-rootfs", "target.arm-unknown-linux-gnueabihf.qemu-rootfs", "rootfs in qemu testing, you probably don't want to use this") v("qemu-aarch64-rootfs", "target.aarch64-unknown-linux-gnu.qemu-rootfs", From 494ce1e22471454808c730680a4661719cc4c9dd Mon Sep 17 00:00:00 2001 From: onur-ozkan Date: Tue, 12 Mar 2024 11:34:14 +0300 Subject: [PATCH 02/11] prevent notifying the same changes more than once Signed-off-by: onur-ozkan --- src/bootstrap/src/bin/main.rs | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/bootstrap/src/bin/main.rs b/src/bootstrap/src/bin/main.rs index 070d951dba99a..98495f25bc662 100644 --- a/src/bootstrap/src/bin/main.rs +++ b/src/bootstrap/src/bin/main.rs @@ -7,6 +7,7 @@ use std::io::Write; use std::process; +use std::str::FromStr; use std::{ env, fs::{self, OpenOptions}, @@ -136,16 +137,25 @@ fn check_version(config: &Config) -> Option { let latest_change_id = CONFIG_CHANGE_HISTORY.last().unwrap().change_id; let warned_id_path = config.out.join("bootstrap").join(".last-warned-change-id"); - if let Some(id) = config.change_id { + if let Some(mut id) = config.change_id { if id == latest_change_id { return None; } - if let Ok(last_warned_id) = fs::read_to_string(&warned_id_path) { - if latest_change_id.to_string() == last_warned_id { - return None; + // Always try to use `change-id` from .last-warned-change-id first. If it doesn't exist, + // then use the one from the config.toml. This way we never show the same warnings + // more than once. + if let Ok(t) = fs::read_to_string(&warned_id_path) { + let last_warned_id = + usize::from_str(&t).expect(&format!("{} is corrupted.", warned_id_path.display())); + + // We only use the last_warned_id if it exists in `CONFIG_CHANGE_HISTORY`. + // Otherwise, we may retrieve all the changes if it's not the highest value. + // For better understanding, refer to `change_tracker::find_recent_config_change_ids`. + if CONFIG_CHANGE_HISTORY.iter().any(|config| config.change_id == last_warned_id) { + id = last_warned_id; } - } + }; let changes = find_recent_config_change_ids(id); From b25203e30f4c418c41cf09fd22906dc596e02ad2 Mon Sep 17 00:00:00 2001 From: Chris Denton Date: Sun, 3 Mar 2024 14:44:58 +0000 Subject: [PATCH 03/11] Bump windows-bindgen to 0.54.0 --- Cargo.lock | 10 +-- .../std/src/sys/pal/windows/c/windows_sys.rs | 62 +++++++++---------- src/tools/generate-windows-sys/Cargo.toml | 2 +- 3 files changed, 38 insertions(+), 36 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 16aed3dc49ca0..b5aba6765ccdc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6279,12 +6279,14 @@ dependencies = [ [[package]] name = "windows-bindgen" -version = "0.52.0" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "970efb0b6849eb8a87a898f586af7cc167567b070014c7434514c0bde0ca341c" +checksum = "d86976b4742897f1df038908f5af6c0c1a291262eecf3e05abf1799bd3002dc2" dependencies = [ "proc-macro2", "rayon", + "serde", + "serde_json", "syn 2.0.52", "windows-metadata", ] @@ -6300,9 +6302,9 @@ dependencies = [ [[package]] name = "windows-metadata" -version = "0.52.0" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "218fd59201e26acdbb894fa2b302d1de84bf3eec7d0eb894ac8e9c5a854ee4ef" +checksum = "e44370b8367d7fd54085dff98fa774ead5070dd15aa892270a370555e35d04c2" [[package]] name = "windows-sys" diff --git a/library/std/src/sys/pal/windows/c/windows_sys.rs b/library/std/src/sys/pal/windows/c/windows_sys.rs index baaa8257d8452..8e5738b30b486 100644 --- a/library/std/src/sys/pal/windows/c/windows_sys.rs +++ b/library/std/src/sys/pal/windows/c/windows_sys.rs @@ -1,4 +1,4 @@ -// Bindings generated by `windows-bindgen` 0.52.0 +// Bindings generated by `windows-bindgen` 0.54.0 #![allow(non_snake_case, non_upper_case_globals, non_camel_case_types, dead_code, clippy::all)] #[link(name = "advapi32")] @@ -17,11 +17,11 @@ extern "system" { } #[link(name = "kernel32")] extern "system" { - pub fn AcquireSRWLockExclusive(srwlock: *mut SRWLOCK) -> (); + pub fn AcquireSRWLockExclusive(srwlock: *mut SRWLOCK); } #[link(name = "kernel32")] extern "system" { - pub fn AcquireSRWLockShared(srwlock: *mut SRWLOCK) -> (); + pub fn AcquireSRWLockShared(srwlock: *mut SRWLOCK); } #[link(name = "kernel32")] extern "system" { @@ -150,7 +150,7 @@ extern "system" { } #[link(name = "kernel32")] extern "system" { - pub fn DeleteProcThreadAttributeList(lpattributelist: LPPROC_THREAD_ATTRIBUTE_LIST) -> (); + pub fn DeleteProcThreadAttributeList(lpattributelist: LPPROC_THREAD_ATTRIBUTE_LIST); } #[link(name = "kernel32")] extern "system" { @@ -338,11 +338,11 @@ extern "system" { } #[link(name = "kernel32")] extern "system" { - pub fn GetSystemInfo(lpsysteminfo: *mut SYSTEM_INFO) -> (); + pub fn GetSystemInfo(lpsysteminfo: *mut SYSTEM_INFO); } #[link(name = "kernel32")] extern "system" { - pub fn GetSystemTimeAsFileTime(lpsystemtimeasfiletime: *mut FILETIME) -> (); + pub fn GetSystemTimeAsFileTime(lpsystemtimeasfiletime: *mut FILETIME); } #[link(name = "kernel32")] extern "system" { @@ -445,11 +445,11 @@ extern "system" { } #[link(name = "kernel32")] extern "system" { - pub fn ReleaseSRWLockExclusive(srwlock: *mut SRWLOCK) -> (); + pub fn ReleaseSRWLockExclusive(srwlock: *mut SRWLOCK); } #[link(name = "kernel32")] extern "system" { - pub fn ReleaseSRWLockShared(srwlock: *mut SRWLOCK) -> (); + pub fn ReleaseSRWLockShared(srwlock: *mut SRWLOCK); } #[link(name = "kernel32")] extern "system" { @@ -503,7 +503,7 @@ extern "system" { } #[link(name = "kernel32")] extern "system" { - pub fn SetLastError(dwerrcode: WIN32_ERROR) -> (); + pub fn SetLastError(dwerrcode: WIN32_ERROR); } #[link(name = "kernel32")] extern "system" { @@ -522,7 +522,7 @@ extern "system" { } #[link(name = "kernel32")] extern "system" { - pub fn Sleep(dwmilliseconds: u32) -> (); + pub fn Sleep(dwmilliseconds: u32); } #[link(name = "kernel32")] extern "system" { @@ -596,11 +596,11 @@ extern "system" { } #[link(name = "kernel32")] extern "system" { - pub fn WakeAllConditionVariable(conditionvariable: *mut CONDITION_VARIABLE) -> (); + pub fn WakeAllConditionVariable(conditionvariable: *mut CONDITION_VARIABLE); } #[link(name = "kernel32")] extern "system" { - pub fn WakeConditionVariable(conditionvariable: *mut CONDITION_VARIABLE) -> (); + pub fn WakeConditionVariable(conditionvariable: *mut CONDITION_VARIABLE); } #[link(name = "kernel32")] extern "system" { @@ -760,7 +760,7 @@ extern "system" { } #[link(name = "ws2_32")] extern "system" { - pub fn freeaddrinfo(paddrinfo: *const ADDRINFOA) -> (); + pub fn freeaddrinfo(paddrinfo: *const ADDRINFOA); } #[link(name = "ws2_32")] extern "system" { @@ -3083,9 +3083,9 @@ impl ::core::clone::Clone for EXCEPTION_RECORD { *self } } -pub const EXCEPTION_STACK_OVERFLOW: NTSTATUS = -1073741571i32; +pub const EXCEPTION_STACK_OVERFLOW: NTSTATUS = 0xC00000FD_u32 as _; pub const EXTENDED_STARTUPINFO_PRESENT: PROCESS_CREATION_FLAGS = 524288u32; -pub const E_NOTIMPL: HRESULT = -2147467263i32; +pub const E_NOTIMPL: HRESULT = 0x80004001_u32 as _; pub const ExceptionCollidedUnwind: EXCEPTION_DISPOSITION = 3i32; pub const ExceptionContinueExecution: EXCEPTION_DISPOSITION = 0i32; pub const ExceptionContinueSearch: EXCEPTION_DISPOSITION = 1i32; @@ -3646,7 +3646,7 @@ pub type LPOVERLAPPED_COMPLETION_ROUTINE = ::core::option::Option< dwerrorcode: u32, dwnumberofbytestransfered: u32, lpoverlapped: *mut OVERLAPPED, - ) -> (), + ), >; pub type LPPROC_THREAD_ATTRIBUTE_LIST = *mut ::core::ffi::c_void; pub type LPPROGRESS_ROUTINE = ::core::option::Option< @@ -3672,7 +3672,7 @@ pub type LPWSAOVERLAPPED_COMPLETION_ROUTINE = ::core::option::Option< cbtransferred: u32, lpoverlapped: *mut OVERLAPPED, dwflags: u32, - ) -> (), + ), >; #[repr(C)] pub struct M128A { @@ -3771,7 +3771,7 @@ pub type PIO_APC_ROUTINE = ::core::option::Option< apccontext: *mut ::core::ffi::c_void, iostatusblock: *mut IO_STATUS_BLOCK, reserved: u32, - ) -> (), + ), >; pub const PIPE_ACCEPT_REMOTE_CLIENTS: NAMED_PIPE_MODE = 0u32; pub const PIPE_ACCESS_DUPLEX: FILE_FLAGS_AND_ATTRIBUTES = 3u32; @@ -3814,7 +3814,7 @@ pub type PTIMERAPCROUTINE = ::core::option::Option< lpargtocompletionroutine: *const ::core::ffi::c_void, dwtimerlowvalue: u32, dwtimerhighvalue: u32, - ) -> (), + ), >; pub type PWSTR = *mut u16; pub const READ_CONTROL: FILE_ACCESS_RIGHTS = 131072u32; @@ -3847,7 +3847,7 @@ pub type SET_FILE_POINTER_MOVE_METHOD = u32; #[repr(C)] pub struct SOCKADDR { pub sa_family: ADDRESS_FAMILY, - pub sa_data: [u8; 14], + pub sa_data: [i8; 14], } impl ::core::marker::Copy for SOCKADDR {} impl ::core::clone::Clone for SOCKADDR { @@ -3858,7 +3858,7 @@ impl ::core::clone::Clone for SOCKADDR { #[repr(C)] pub struct SOCKADDR_UN { pub sun_family: ADDRESS_FAMILY, - pub sun_path: [u8; 108], + pub sun_path: [i8; 108], } impl ::core::marker::Copy for SOCKADDR_UN {} impl ::core::clone::Clone for SOCKADDR_UN { @@ -3949,12 +3949,12 @@ impl ::core::clone::Clone for STARTUPINFOW { } } pub type STARTUPINFOW_FLAGS = u32; -pub const STATUS_DELETE_PENDING: NTSTATUS = -1073741738i32; -pub const STATUS_END_OF_FILE: NTSTATUS = -1073741807i32; -pub const STATUS_INVALID_PARAMETER: NTSTATUS = -1073741811i32; -pub const STATUS_NOT_IMPLEMENTED: NTSTATUS = -1073741822i32; -pub const STATUS_PENDING: NTSTATUS = 259i32; -pub const STATUS_SUCCESS: NTSTATUS = 0i32; +pub const STATUS_DELETE_PENDING: NTSTATUS = 0xC0000056_u32 as _; +pub const STATUS_END_OF_FILE: NTSTATUS = 0xC0000011_u32 as _; +pub const STATUS_INVALID_PARAMETER: NTSTATUS = 0xC000000D_u32 as _; +pub const STATUS_NOT_IMPLEMENTED: NTSTATUS = 0xC0000002_u32 as _; +pub const STATUS_PENDING: NTSTATUS = 0x103_u32 as _; +pub const STATUS_SUCCESS: NTSTATUS = 0x0_u32 as _; pub const STD_ERROR_HANDLE: STD_HANDLE = 4294967284u32; pub type STD_HANDLE = u32; pub const STD_INPUT_HANDLE: STD_HANDLE = 4294967286u32; @@ -4115,8 +4115,8 @@ pub struct WSADATA { pub iMaxSockets: u16, pub iMaxUdpDg: u16, pub lpVendorInfo: PSTR, - pub szDescription: [u8; 257], - pub szSystemStatus: [u8; 129], + pub szDescription: [i8; 257], + pub szSystemStatus: [i8; 129], } #[cfg(any(target_arch = "aarch64", target_arch = "x86_64"))] impl ::core::marker::Copy for WSADATA {} @@ -4131,8 +4131,8 @@ impl ::core::clone::Clone for WSADATA { pub struct WSADATA { pub wVersion: u16, pub wHighVersion: u16, - pub szDescription: [u8; 257], - pub szSystemStatus: [u8; 129], + pub szDescription: [i8; 257], + pub szSystemStatus: [i8; 129], pub iMaxSockets: u16, pub iMaxUdpDg: u16, pub lpVendorInfo: PSTR, diff --git a/src/tools/generate-windows-sys/Cargo.toml b/src/tools/generate-windows-sys/Cargo.toml index d8a7a06efc6d4..ca137211f4ea0 100644 --- a/src/tools/generate-windows-sys/Cargo.toml +++ b/src/tools/generate-windows-sys/Cargo.toml @@ -4,4 +4,4 @@ version = "0.1.0" edition = "2021" [dependencies.windows-bindgen] -version = "0.52.0" +version = "0.54.0" From 8e870c8ed194e34e6fdd6fa1160dffee10e6a210 Mon Sep 17 00:00:00 2001 From: Chris Denton Date: Thu, 7 Mar 2024 16:06:57 +0000 Subject: [PATCH 04/11] Bump windows-bindgen to 0.55.0 --- Cargo.lock | 8 +- .../std/src/sys/pal/windows/c/windows_sys.rs | 364 +++++++++--------- src/tools/generate-windows-sys/Cargo.toml | 2 +- 3 files changed, 186 insertions(+), 188 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b5aba6765ccdc..a7553153e3225 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6279,9 +6279,9 @@ dependencies = [ [[package]] name = "windows-bindgen" -version = "0.54.0" +version = "0.55.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d86976b4742897f1df038908f5af6c0c1a291262eecf3e05abf1799bd3002dc2" +checksum = "073ff8a486ebad239d557809d2cd5fe5e04ee1de29e09c6cd83fb0bae19b8a4c" dependencies = [ "proc-macro2", "rayon", @@ -6302,9 +6302,9 @@ dependencies = [ [[package]] name = "windows-metadata" -version = "0.54.0" +version = "0.55.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e44370b8367d7fd54085dff98fa774ead5070dd15aa892270a370555e35d04c2" +checksum = "b602635050172a1fc57a35040d4d225baefc6098fefd97094919921d95961a7d" [[package]] name = "windows-sys" diff --git a/library/std/src/sys/pal/windows/c/windows_sys.rs b/library/std/src/sys/pal/windows/c/windows_sys.rs index 8e5738b30b486..d180122d735f3 100644 --- a/library/std/src/sys/pal/windows/c/windows_sys.rs +++ b/library/std/src/sys/pal/windows/c/windows_sys.rs @@ -1,4 +1,4 @@ -// Bindings generated by `windows-bindgen` 0.54.0 +// Bindings generated by `windows-bindgen` 0.55.0 #![allow(non_snake_case, non_upper_case_globals, non_camel_case_types, dead_code, clippy::all)] #[link(name = "advapi32")] @@ -12,8 +12,7 @@ extern "system" { #[link(name = "advapi32")] extern "system" { #[link_name = "SystemFunction036"] - pub fn RtlGenRandom(randombuffer: *mut ::core::ffi::c_void, randombufferlength: u32) - -> BOOLEAN; + pub fn RtlGenRandom(randombuffer: *mut core::ffi::c_void, randombufferlength: u32) -> BOOLEAN; } #[link(name = "kernel32")] extern "system" { @@ -47,7 +46,7 @@ extern "system" { lpexistingfilename: PCWSTR, lpnewfilename: PCWSTR, lpprogressroutine: LPPROGRESS_ROUTINE, - lpdata: *const ::core::ffi::c_void, + lpdata: *const core::ffi::c_void, pbcancel: *mut BOOL, dwcopyflags: u32, ) -> BOOL; @@ -110,7 +109,7 @@ extern "system" { lpthreadattributes: *const SECURITY_ATTRIBUTES, binherithandles: BOOL, dwcreationflags: PROCESS_CREATION_FLAGS, - lpenvironment: *const ::core::ffi::c_void, + lpenvironment: *const core::ffi::c_void, lpcurrentdirectory: PCWSTR, lpstartupinfo: *const STARTUPINFOW, lpprocessinformation: *mut PROCESS_INFORMATION, @@ -130,7 +129,7 @@ extern "system" { lpthreadattributes: *const SECURITY_ATTRIBUTES, dwstacksize: usize, lpstartaddress: LPTHREAD_START_ROUTINE, - lpparameter: *const ::core::ffi::c_void, + lpparameter: *const core::ffi::c_void, dwcreationflags: THREAD_CREATION_FLAGS, lpthreadid: *mut u32, ) -> HANDLE; @@ -157,9 +156,9 @@ extern "system" { pub fn DeviceIoControl( hdevice: HANDLE, dwiocontrolcode: u32, - lpinbuffer: *const ::core::ffi::c_void, + lpinbuffer: *const core::ffi::c_void, ninbuffersize: u32, - lpoutbuffer: *mut ::core::ffi::c_void, + lpoutbuffer: *mut core::ffi::c_void, noutbuffersize: u32, lpbytesreturned: *mut u32, lpoverlapped: *mut OVERLAPPED, @@ -201,7 +200,7 @@ extern "system" { extern "system" { pub fn FormatMessageW( dwflags: FORMAT_MESSAGE_OPTIONS, - lpsource: *const ::core::ffi::c_void, + lpsource: *const core::ffi::c_void, dwmessageid: u32, dwlanguageid: u32, lpbuffer: PWSTR, @@ -269,7 +268,7 @@ extern "system" { pub fn GetFileInformationByHandleEx( hfile: HANDLE, fileinformationclass: FILE_INFO_BY_HANDLE_CLASS, - lpfileinformation: *mut ::core::ffi::c_void, + lpfileinformation: *mut core::ffi::c_void, dwbuffersize: u32, ) -> BOOL; } @@ -362,7 +361,7 @@ extern "system" { lpinitonce: *mut INIT_ONCE, dwflags: u32, fpending: *mut BOOL, - lpcontext: *mut *mut ::core::ffi::c_void, + lpcontext: *mut *mut core::ffi::c_void, ) -> BOOL; } #[link(name = "kernel32")] @@ -370,7 +369,7 @@ extern "system" { pub fn InitOnceComplete( lpinitonce: *mut INIT_ONCE, dwflags: u32, - lpcontext: *const ::core::ffi::c_void, + lpcontext: *const core::ffi::c_void, ) -> BOOL; } #[link(name = "kernel32")] @@ -417,7 +416,7 @@ extern "system" { extern "system" { pub fn ReadConsoleW( hconsoleinput: HANDLE, - lpbuffer: *mut ::core::ffi::c_void, + lpbuffer: *mut core::ffi::c_void, nnumberofcharstoread: u32, lpnumberofcharsread: *mut u32, pinputcontrol: *const CONSOLE_READCONSOLE_CONTROL, @@ -475,7 +474,7 @@ extern "system" { pub fn SetFileInformationByHandle( hfile: HANDLE, fileinformationclass: FILE_INFO_BY_HANDLE_CLASS, - lpfileinformation: *const ::core::ffi::c_void, + lpfileinformation: *const core::ffi::c_void, dwbuffersize: u32, ) -> BOOL; } @@ -516,7 +515,7 @@ extern "system" { lpduetime: *const i64, lperiod: i32, pfncompletionroutine: PTIMERAPCROUTINE, - lpargtocompletionroutine: *const ::core::ffi::c_void, + lpargtocompletionroutine: *const core::ffi::c_void, fresume: BOOL, ) -> BOOL; } @@ -555,11 +554,11 @@ extern "system" { } #[link(name = "kernel32")] extern "system" { - pub fn TlsGetValue(dwtlsindex: u32) -> *mut ::core::ffi::c_void; + pub fn TlsGetValue(dwtlsindex: u32) -> *mut core::ffi::c_void; } #[link(name = "kernel32")] extern "system" { - pub fn TlsSetValue(dwtlsindex: u32, lptlsvalue: *const ::core::ffi::c_void) -> BOOL; + pub fn TlsSetValue(dwtlsindex: u32, lptlsvalue: *const core::ffi::c_void) -> BOOL; } #[link(name = "kernel32")] extern "system" { @@ -575,9 +574,9 @@ extern "system" { lpattributelist: LPPROC_THREAD_ATTRIBUTE_LIST, dwflags: u32, attribute: usize, - lpvalue: *const ::core::ffi::c_void, + lpvalue: *const core::ffi::c_void, cbsize: usize, - lppreviousvalue: *mut ::core::ffi::c_void, + lppreviousvalue: *mut core::ffi::c_void, lpreturnsize: *const usize, ) -> BOOL; } @@ -619,10 +618,10 @@ extern "system" { extern "system" { pub fn WriteConsoleW( hconsoleoutput: HANDLE, - lpbuffer: *const ::core::ffi::c_void, + lpbuffer: *const core::ffi::c_void, nnumberofcharstowrite: u32, lpnumberofcharswritten: *mut u32, - lpreserved: *const ::core::ffi::c_void, + lpreserved: *const core::ffi::c_void, ) -> BOOL; } #[link(name = "kernel32")] @@ -647,7 +646,7 @@ extern "system" { shareaccess: FILE_SHARE_MODE, createdisposition: NTCREATEFILE_CREATE_DISPOSITION, createoptions: NTCREATEFILE_CREATE_OPTIONS, - eabuffer: *const ::core::ffi::c_void, + eabuffer: *const core::ffi::c_void, ealength: u32, ) -> NTSTATUS; } @@ -657,9 +656,9 @@ extern "system" { filehandle: HANDLE, event: HANDLE, apcroutine: PIO_APC_ROUTINE, - apccontext: *const ::core::ffi::c_void, + apccontext: *const core::ffi::c_void, iostatusblock: *mut IO_STATUS_BLOCK, - buffer: *mut ::core::ffi::c_void, + buffer: *mut core::ffi::c_void, length: u32, byteoffset: *const i64, key: *const u32, @@ -671,9 +670,9 @@ extern "system" { filehandle: HANDLE, event: HANDLE, apcroutine: PIO_APC_ROUTINE, - apccontext: *const ::core::ffi::c_void, + apccontext: *const core::ffi::c_void, iostatusblock: *mut IO_STATUS_BLOCK, - buffer: *const ::core::ffi::c_void, + buffer: *const core::ffi::c_void, length: u32, byteoffset: *const i64, key: *const u32, @@ -852,8 +851,8 @@ pub struct ADDRINFOA { pub ai_addr: *mut SOCKADDR, pub ai_next: *mut ADDRINFOA, } -impl ::core::marker::Copy for ADDRINFOA {} -impl ::core::clone::Clone for ADDRINFOA { +impl Copy for ADDRINFOA {} +impl Clone for ADDRINFOA { fn clone(&self) -> Self { *self } @@ -871,8 +870,8 @@ pub union ARM64_NT_NEON128 { pub H: [u16; 8], pub B: [u8; 16], } -impl ::core::marker::Copy for ARM64_NT_NEON128 {} -impl ::core::clone::Clone for ARM64_NT_NEON128 { +impl Copy for ARM64_NT_NEON128 {} +impl Clone for ARM64_NT_NEON128 { fn clone(&self) -> Self { *self } @@ -882,8 +881,8 @@ pub struct ARM64_NT_NEON128_0 { pub Low: u64, pub High: i64, } -impl ::core::marker::Copy for ARM64_NT_NEON128_0 {} -impl ::core::clone::Clone for ARM64_NT_NEON128_0 { +impl Copy for ARM64_NT_NEON128_0 {} +impl Clone for ARM64_NT_NEON128_0 { fn clone(&self) -> Self { *self } @@ -904,8 +903,8 @@ pub struct BY_HANDLE_FILE_INFORMATION { pub nFileIndexHigh: u32, pub nFileIndexLow: u32, } -impl ::core::marker::Copy for BY_HANDLE_FILE_INFORMATION {} -impl ::core::clone::Clone for BY_HANDLE_FILE_INFORMATION { +impl Copy for BY_HANDLE_FILE_INFORMATION {} +impl Clone for BY_HANDLE_FILE_INFORMATION { fn clone(&self) -> Self { *self } @@ -915,10 +914,10 @@ pub const CALLBACK_STREAM_SWITCH: LPPROGRESS_ROUTINE_CALLBACK_REASON = 1u32; pub type COMPARESTRING_RESULT = i32; #[repr(C)] pub struct CONDITION_VARIABLE { - pub Ptr: *mut ::core::ffi::c_void, + pub Ptr: *mut core::ffi::c_void, } -impl ::core::marker::Copy for CONDITION_VARIABLE {} -impl ::core::clone::Clone for CONDITION_VARIABLE { +impl Copy for CONDITION_VARIABLE {} +impl Clone for CONDITION_VARIABLE { fn clone(&self) -> Self { *self } @@ -931,8 +930,8 @@ pub struct CONSOLE_READCONSOLE_CONTROL { pub dwCtrlWakeupMask: u32, pub dwControlKeyState: u32, } -impl ::core::marker::Copy for CONSOLE_READCONSOLE_CONTROL {} -impl ::core::clone::Clone for CONSOLE_READCONSOLE_CONTROL { +impl Copy for CONSOLE_READCONSOLE_CONTROL {} +impl Clone for CONSOLE_READCONSOLE_CONTROL { fn clone(&self) -> Self { *self } @@ -954,9 +953,9 @@ pub struct CONTEXT { pub Wvr: [u64; 2], } #[cfg(target_arch = "aarch64")] -impl ::core::marker::Copy for CONTEXT {} +impl Copy for CONTEXT {} #[cfg(target_arch = "aarch64")] -impl ::core::clone::Clone for CONTEXT { +impl Clone for CONTEXT { fn clone(&self) -> Self { *self } @@ -968,9 +967,9 @@ pub union CONTEXT_0 { pub X: [u64; 31], } #[cfg(target_arch = "aarch64")] -impl ::core::marker::Copy for CONTEXT_0 {} +impl Copy for CONTEXT_0 {} #[cfg(target_arch = "aarch64")] -impl ::core::clone::Clone for CONTEXT_0 { +impl Clone for CONTEXT_0 { fn clone(&self) -> Self { *self } @@ -1011,9 +1010,9 @@ pub struct CONTEXT_0_0 { pub Lr: u64, } #[cfg(target_arch = "aarch64")] -impl ::core::marker::Copy for CONTEXT_0_0 {} +impl Copy for CONTEXT_0_0 {} #[cfg(target_arch = "aarch64")] -impl ::core::clone::Clone for CONTEXT_0_0 { +impl Clone for CONTEXT_0_0 { fn clone(&self) -> Self { *self } @@ -1069,9 +1068,9 @@ pub struct CONTEXT { pub LastExceptionFromRip: u64, } #[cfg(target_arch = "x86_64")] -impl ::core::marker::Copy for CONTEXT {} +impl Copy for CONTEXT {} #[cfg(target_arch = "x86_64")] -impl ::core::clone::Clone for CONTEXT { +impl Clone for CONTEXT { fn clone(&self) -> Self { *self } @@ -1083,9 +1082,9 @@ pub union CONTEXT_0 { pub Anonymous: CONTEXT_0_0, } #[cfg(target_arch = "x86_64")] -impl ::core::marker::Copy for CONTEXT_0 {} +impl Copy for CONTEXT_0 {} #[cfg(target_arch = "x86_64")] -impl ::core::clone::Clone for CONTEXT_0 { +impl Clone for CONTEXT_0 { fn clone(&self) -> Self { *self } @@ -1113,9 +1112,9 @@ pub struct CONTEXT_0_0 { pub Xmm15: M128A, } #[cfg(target_arch = "x86_64")] -impl ::core::marker::Copy for CONTEXT_0_0 {} +impl Copy for CONTEXT_0_0 {} #[cfg(target_arch = "x86_64")] -impl ::core::clone::Clone for CONTEXT_0_0 { +impl Clone for CONTEXT_0_0 { fn clone(&self) -> Self { *self } @@ -1150,9 +1149,9 @@ pub struct CONTEXT { pub ExtendedRegisters: [u8; 512], } #[cfg(target_arch = "x86")] -impl ::core::marker::Copy for CONTEXT {} +impl Copy for CONTEXT {} #[cfg(target_arch = "x86")] -impl ::core::clone::Clone for CONTEXT { +impl Clone for CONTEXT { fn clone(&self) -> Self { *self } @@ -3073,12 +3072,12 @@ pub struct EXCEPTION_RECORD { pub ExceptionCode: NTSTATUS, pub ExceptionFlags: u32, pub ExceptionRecord: *mut EXCEPTION_RECORD, - pub ExceptionAddress: *mut ::core::ffi::c_void, + pub ExceptionAddress: *mut core::ffi::c_void, pub NumberParameters: u32, pub ExceptionInformation: [usize; 15], } -impl ::core::marker::Copy for EXCEPTION_RECORD {} -impl ::core::clone::Clone for EXCEPTION_RECORD { +impl Copy for EXCEPTION_RECORD {} +impl Clone for EXCEPTION_RECORD { fn clone(&self) -> Self { *self } @@ -3093,15 +3092,15 @@ pub const ExceptionNestedException: EXCEPTION_DISPOSITION = 2i32; pub type FACILITY_CODE = u32; pub const FACILITY_NT_BIT: FACILITY_CODE = 268435456u32; pub const FALSE: BOOL = 0i32; -pub type FARPROC = ::core::option::Option isize>; +pub type FARPROC = Option isize>; pub const FAST_FAIL_FATAL_APP_EXIT: u32 = 7u32; #[repr(C)] pub struct FD_SET { pub fd_count: u32, pub fd_array: [SOCKET; 64], } -impl ::core::marker::Copy for FD_SET {} -impl ::core::clone::Clone for FD_SET { +impl Copy for FD_SET {} +impl Clone for FD_SET { fn clone(&self) -> Self { *self } @@ -3111,8 +3110,8 @@ pub struct FILETIME { pub dwLowDateTime: u32, pub dwHighDateTime: u32, } -impl ::core::marker::Copy for FILETIME {} -impl ::core::clone::Clone for FILETIME { +impl Copy for FILETIME {} +impl Clone for FILETIME { fn clone(&self) -> Self { *self } @@ -3124,8 +3123,8 @@ pub const FILE_ADD_SUBDIRECTORY: FILE_ACCESS_RIGHTS = 4u32; pub struct FILE_ALLOCATION_INFO { pub AllocationSize: i64, } -impl ::core::marker::Copy for FILE_ALLOCATION_INFO {} -impl ::core::clone::Clone for FILE_ALLOCATION_INFO { +impl Copy for FILE_ALLOCATION_INFO {} +impl Clone for FILE_ALLOCATION_INFO { fn clone(&self) -> Self { *self } @@ -3156,8 +3155,8 @@ pub struct FILE_ATTRIBUTE_TAG_INFO { pub FileAttributes: u32, pub ReparseTag: u32, } -impl ::core::marker::Copy for FILE_ATTRIBUTE_TAG_INFO {} -impl ::core::clone::Clone for FILE_ATTRIBUTE_TAG_INFO { +impl Copy for FILE_ATTRIBUTE_TAG_INFO {} +impl Clone for FILE_ATTRIBUTE_TAG_INFO { fn clone(&self) -> Self { *self } @@ -3173,8 +3172,8 @@ pub struct FILE_BASIC_INFO { pub ChangeTime: i64, pub FileAttributes: u32, } -impl ::core::marker::Copy for FILE_BASIC_INFO {} -impl ::core::clone::Clone for FILE_BASIC_INFO { +impl Copy for FILE_BASIC_INFO {} +impl Clone for FILE_BASIC_INFO { fn clone(&self) -> Self { *self } @@ -3201,8 +3200,8 @@ pub const FILE_DISPOSITION_FLAG_POSIX_SEMANTICS: FILE_DISPOSITION_INFO_EX_FLAGS pub struct FILE_DISPOSITION_INFO { pub DeleteFile: BOOLEAN, } -impl ::core::marker::Copy for FILE_DISPOSITION_INFO {} -impl ::core::clone::Clone for FILE_DISPOSITION_INFO { +impl Copy for FILE_DISPOSITION_INFO {} +impl Clone for FILE_DISPOSITION_INFO { fn clone(&self) -> Self { *self } @@ -3211,8 +3210,8 @@ impl ::core::clone::Clone for FILE_DISPOSITION_INFO { pub struct FILE_DISPOSITION_INFO_EX { pub Flags: FILE_DISPOSITION_INFO_EX_FLAGS, } -impl ::core::marker::Copy for FILE_DISPOSITION_INFO_EX {} -impl ::core::clone::Clone for FILE_DISPOSITION_INFO_EX { +impl Copy for FILE_DISPOSITION_INFO_EX {} +impl Clone for FILE_DISPOSITION_INFO_EX { fn clone(&self) -> Self { *self } @@ -3223,8 +3222,8 @@ pub const FILE_END: SET_FILE_POINTER_MOVE_METHOD = 2u32; pub struct FILE_END_OF_FILE_INFO { pub EndOfFile: i64, } -impl ::core::marker::Copy for FILE_END_OF_FILE_INFO {} -impl ::core::clone::Clone for FILE_END_OF_FILE_INFO { +impl Copy for FILE_END_OF_FILE_INFO {} +impl Clone for FILE_END_OF_FILE_INFO { fn clone(&self) -> Self { *self } @@ -3264,8 +3263,8 @@ pub struct FILE_ID_BOTH_DIR_INFO { pub FileId: i64, pub FileName: [u16; 1], } -impl ::core::marker::Copy for FILE_ID_BOTH_DIR_INFO {} -impl ::core::clone::Clone for FILE_ID_BOTH_DIR_INFO { +impl Copy for FILE_ID_BOTH_DIR_INFO {} +impl Clone for FILE_ID_BOTH_DIR_INFO { fn clone(&self) -> Self { *self } @@ -3275,8 +3274,8 @@ pub type FILE_INFO_BY_HANDLE_CLASS = i32; pub struct FILE_IO_PRIORITY_HINT_INFO { pub PriorityHint: PRIORITY_HINT, } -impl ::core::marker::Copy for FILE_IO_PRIORITY_HINT_INFO {} -impl ::core::clone::Clone for FILE_IO_PRIORITY_HINT_INFO { +impl Copy for FILE_IO_PRIORITY_HINT_INFO {} +impl Clone for FILE_IO_PRIORITY_HINT_INFO { fn clone(&self) -> Self { *self } @@ -3318,8 +3317,8 @@ pub struct FILE_STANDARD_INFO { pub DeletePending: BOOLEAN, pub Directory: BOOLEAN, } -impl ::core::marker::Copy for FILE_STANDARD_INFO {} -impl ::core::clone::Clone for FILE_STANDARD_INFO { +impl Copy for FILE_STANDARD_INFO {} +impl Clone for FILE_STANDARD_INFO { fn clone(&self) -> Self { *self } @@ -3353,9 +3352,9 @@ pub struct FLOATING_SAVE_AREA { pub Cr0NpxState: u32, } #[cfg(any(target_arch = "aarch64", target_arch = "x86_64"))] -impl ::core::marker::Copy for FLOATING_SAVE_AREA {} +impl Copy for FLOATING_SAVE_AREA {} #[cfg(any(target_arch = "aarch64", target_arch = "x86_64"))] -impl ::core::clone::Clone for FLOATING_SAVE_AREA { +impl Clone for FLOATING_SAVE_AREA { fn clone(&self) -> Self { *self } @@ -3374,9 +3373,9 @@ pub struct FLOATING_SAVE_AREA { pub Spare0: u32, } #[cfg(target_arch = "x86")] -impl ::core::marker::Copy for FLOATING_SAVE_AREA {} +impl Copy for FLOATING_SAVE_AREA {} #[cfg(target_arch = "x86")] -impl ::core::clone::Clone for FLOATING_SAVE_AREA { +impl Clone for FLOATING_SAVE_AREA { fn clone(&self) -> Self { *self } @@ -3429,8 +3428,8 @@ pub struct GUID { pub data3: u16, pub data4: [u8; 8], } -impl ::core::marker::Copy for GUID {} -impl ::core::clone::Clone for GUID { +impl Copy for GUID {} +impl Clone for GUID { fn clone(&self) -> Self { *self } @@ -3445,21 +3444,21 @@ impl GUID { } } } -pub type HANDLE = *mut ::core::ffi::c_void; +pub type HANDLE = *mut core::ffi::c_void; pub type HANDLE_FLAGS = u32; pub const HANDLE_FLAG_INHERIT: HANDLE_FLAGS = 1u32; pub const HANDLE_FLAG_PROTECT_FROM_CLOSE: HANDLE_FLAGS = 2u32; pub const HIGH_PRIORITY_CLASS: PROCESS_CREATION_FLAGS = 128u32; -pub type HLOCAL = *mut ::core::ffi::c_void; -pub type HMODULE = *mut ::core::ffi::c_void; +pub type HLOCAL = *mut core::ffi::c_void; +pub type HMODULE = *mut core::ffi::c_void; pub type HRESULT = i32; pub const IDLE_PRIORITY_CLASS: PROCESS_CREATION_FLAGS = 64u32; #[repr(C)] pub struct IN6_ADDR { pub u: IN6_ADDR_0, } -impl ::core::marker::Copy for IN6_ADDR {} -impl ::core::clone::Clone for IN6_ADDR { +impl Copy for IN6_ADDR {} +impl Clone for IN6_ADDR { fn clone(&self) -> Self { *self } @@ -3469,8 +3468,8 @@ pub union IN6_ADDR_0 { pub Byte: [u8; 16], pub Word: [u16; 8], } -impl ::core::marker::Copy for IN6_ADDR_0 {} -impl ::core::clone::Clone for IN6_ADDR_0 { +impl Copy for IN6_ADDR_0 {} +impl Clone for IN6_ADDR_0 { fn clone(&self) -> Self { *self } @@ -3480,10 +3479,10 @@ pub const INHERIT_CALLER_PRIORITY: PROCESS_CREATION_FLAGS = 131072u32; pub const INHERIT_PARENT_AFFINITY: PROCESS_CREATION_FLAGS = 65536u32; #[repr(C)] pub union INIT_ONCE { - pub Ptr: *mut ::core::ffi::c_void, + pub Ptr: *mut core::ffi::c_void, } -impl ::core::marker::Copy for INIT_ONCE {} -impl ::core::clone::Clone for INIT_ONCE { +impl Copy for INIT_ONCE {} +impl Clone for INIT_ONCE { fn clone(&self) -> Self { *self } @@ -3495,8 +3494,8 @@ pub const INVALID_SOCKET: SOCKET = -1i32 as _; pub struct IN_ADDR { pub S_un: IN_ADDR_0, } -impl ::core::marker::Copy for IN_ADDR {} -impl ::core::clone::Clone for IN_ADDR { +impl Copy for IN_ADDR {} +impl Clone for IN_ADDR { fn clone(&self) -> Self { *self } @@ -3507,8 +3506,8 @@ pub union IN_ADDR_0 { pub S_un_w: IN_ADDR_0_1, pub S_addr: u32, } -impl ::core::marker::Copy for IN_ADDR_0 {} -impl ::core::clone::Clone for IN_ADDR_0 { +impl Copy for IN_ADDR_0 {} +impl Clone for IN_ADDR_0 { fn clone(&self) -> Self { *self } @@ -3520,8 +3519,8 @@ pub struct IN_ADDR_0_0 { pub s_b3: u8, pub s_b4: u8, } -impl ::core::marker::Copy for IN_ADDR_0_0 {} -impl ::core::clone::Clone for IN_ADDR_0_0 { +impl Copy for IN_ADDR_0_0 {} +impl Clone for IN_ADDR_0_0 { fn clone(&self) -> Self { *self } @@ -3531,8 +3530,8 @@ pub struct IN_ADDR_0_1 { pub s_w1: u16, pub s_w2: u16, } -impl ::core::marker::Copy for IN_ADDR_0_1 {} -impl ::core::clone::Clone for IN_ADDR_0_1 { +impl Copy for IN_ADDR_0_1 {} +impl Clone for IN_ADDR_0_1 { fn clone(&self) -> Self { *self } @@ -3544,8 +3543,8 @@ pub struct IO_STATUS_BLOCK { pub Anonymous: IO_STATUS_BLOCK_0, pub Information: usize, } -impl ::core::marker::Copy for IO_STATUS_BLOCK {} -impl ::core::clone::Clone for IO_STATUS_BLOCK { +impl Copy for IO_STATUS_BLOCK {} +impl Clone for IO_STATUS_BLOCK { fn clone(&self) -> Self { *self } @@ -3553,10 +3552,10 @@ impl ::core::clone::Clone for IO_STATUS_BLOCK { #[repr(C)] pub union IO_STATUS_BLOCK_0 { pub Status: NTSTATUS, - pub Pointer: *mut ::core::ffi::c_void, + pub Pointer: *mut core::ffi::c_void, } -impl ::core::marker::Copy for IO_STATUS_BLOCK_0 {} -impl ::core::clone::Clone for IO_STATUS_BLOCK_0 { +impl Copy for IO_STATUS_BLOCK_0 {} +impl Clone for IO_STATUS_BLOCK_0 { fn clone(&self) -> Self { *self } @@ -3606,8 +3605,8 @@ pub struct IPV6_MREQ { pub ipv6mr_multiaddr: IN6_ADDR, pub ipv6mr_interface: u32, } -impl ::core::marker::Copy for IPV6_MREQ {} -impl ::core::clone::Clone for IPV6_MREQ { +impl Copy for IPV6_MREQ {} +impl Clone for IPV6_MREQ { fn clone(&self) -> Self { *self } @@ -3621,8 +3620,8 @@ pub struct IP_MREQ { pub imr_multiaddr: IN_ADDR, pub imr_interface: IN_ADDR, } -impl ::core::marker::Copy for IP_MREQ {} -impl ::core::clone::Clone for IP_MREQ { +impl Copy for IP_MREQ {} +impl Clone for IP_MREQ { fn clone(&self) -> Self { *self } @@ -3635,21 +3634,21 @@ pub struct LINGER { pub l_onoff: u16, pub l_linger: u16, } -impl ::core::marker::Copy for LINGER {} -impl ::core::clone::Clone for LINGER { +impl Copy for LINGER {} +impl Clone for LINGER { fn clone(&self) -> Self { *self } } -pub type LPOVERLAPPED_COMPLETION_ROUTINE = ::core::option::Option< +pub type LPOVERLAPPED_COMPLETION_ROUTINE = Option< unsafe extern "system" fn( dwerrorcode: u32, dwnumberofbytestransfered: u32, lpoverlapped: *mut OVERLAPPED, ), >; -pub type LPPROC_THREAD_ATTRIBUTE_LIST = *mut ::core::ffi::c_void; -pub type LPPROGRESS_ROUTINE = ::core::option::Option< +pub type LPPROC_THREAD_ATTRIBUTE_LIST = *mut core::ffi::c_void; +pub type LPPROGRESS_ROUTINE = Option< unsafe extern "system" fn( totalfilesize: i64, totalbytestransferred: i64, @@ -3659,14 +3658,13 @@ pub type LPPROGRESS_ROUTINE = ::core::option::Option< dwcallbackreason: LPPROGRESS_ROUTINE_CALLBACK_REASON, hsourcefile: HANDLE, hdestinationfile: HANDLE, - lpdata: *const ::core::ffi::c_void, + lpdata: *const core::ffi::c_void, ) -> u32, >; pub type LPPROGRESS_ROUTINE_CALLBACK_REASON = u32; -pub type LPTHREAD_START_ROUTINE = ::core::option::Option< - unsafe extern "system" fn(lpthreadparameter: *mut ::core::ffi::c_void) -> u32, ->; -pub type LPWSAOVERLAPPED_COMPLETION_ROUTINE = ::core::option::Option< +pub type LPTHREAD_START_ROUTINE = + Option u32>; +pub type LPWSAOVERLAPPED_COMPLETION_ROUTINE = Option< unsafe extern "system" fn( dwerror: u32, cbtransferred: u32, @@ -3679,8 +3677,8 @@ pub struct M128A { pub Low: u64, pub High: i64, } -impl ::core::marker::Copy for M128A {} -impl ::core::clone::Clone for M128A { +impl Copy for M128A {} +impl Clone for M128A { fn clone(&self) -> Self { *self } @@ -3717,11 +3715,11 @@ pub struct OBJECT_ATTRIBUTES { pub RootDirectory: HANDLE, pub ObjectName: *const UNICODE_STRING, pub Attributes: u32, - pub SecurityDescriptor: *const ::core::ffi::c_void, - pub SecurityQualityOfService: *const ::core::ffi::c_void, + pub SecurityDescriptor: *const core::ffi::c_void, + pub SecurityQualityOfService: *const core::ffi::c_void, } -impl ::core::marker::Copy for OBJECT_ATTRIBUTES {} -impl ::core::clone::Clone for OBJECT_ATTRIBUTES { +impl Copy for OBJECT_ATTRIBUTES {} +impl Clone for OBJECT_ATTRIBUTES { fn clone(&self) -> Self { *self } @@ -3736,8 +3734,8 @@ pub struct OVERLAPPED { pub Anonymous: OVERLAPPED_0, pub hEvent: HANDLE, } -impl ::core::marker::Copy for OVERLAPPED {} -impl ::core::clone::Clone for OVERLAPPED { +impl Copy for OVERLAPPED {} +impl Clone for OVERLAPPED { fn clone(&self) -> Self { *self } @@ -3745,10 +3743,10 @@ impl ::core::clone::Clone for OVERLAPPED { #[repr(C)] pub union OVERLAPPED_0 { pub Anonymous: OVERLAPPED_0_0, - pub Pointer: *mut ::core::ffi::c_void, + pub Pointer: *mut core::ffi::c_void, } -impl ::core::marker::Copy for OVERLAPPED_0 {} -impl ::core::clone::Clone for OVERLAPPED_0 { +impl Copy for OVERLAPPED_0 {} +impl Clone for OVERLAPPED_0 { fn clone(&self) -> Self { *self } @@ -3758,17 +3756,17 @@ pub struct OVERLAPPED_0_0 { pub Offset: u32, pub OffsetHigh: u32, } -impl ::core::marker::Copy for OVERLAPPED_0_0 {} -impl ::core::clone::Clone for OVERLAPPED_0_0 { +impl Copy for OVERLAPPED_0_0 {} +impl Clone for OVERLAPPED_0_0 { fn clone(&self) -> Self { *self } } pub type PCSTR = *const u8; pub type PCWSTR = *const u16; -pub type PIO_APC_ROUTINE = ::core::option::Option< +pub type PIO_APC_ROUTINE = Option< unsafe extern "system" fn( - apccontext: *mut ::core::ffi::c_void, + apccontext: *mut core::ffi::c_void, iostatusblock: *mut IO_STATUS_BLOCK, reserved: u32, ), @@ -3796,8 +3794,8 @@ pub struct PROCESS_INFORMATION { pub dwProcessId: u32, pub dwThreadId: u32, } -impl ::core::marker::Copy for PROCESS_INFORMATION {} -impl ::core::clone::Clone for PROCESS_INFORMATION { +impl Copy for PROCESS_INFORMATION {} +impl Clone for PROCESS_INFORMATION { fn clone(&self) -> Self { *self } @@ -3809,9 +3807,9 @@ pub const PROFILE_SERVER: PROCESS_CREATION_FLAGS = 1073741824u32; pub const PROFILE_USER: PROCESS_CREATION_FLAGS = 268435456u32; pub const PROGRESS_CONTINUE: u32 = 0u32; pub type PSTR = *mut u8; -pub type PTIMERAPCROUTINE = ::core::option::Option< +pub type PTIMERAPCROUTINE = Option< unsafe extern "system" fn( - lpargtocompletionroutine: *const ::core::ffi::c_void, + lpargtocompletionroutine: *const core::ffi::c_void, dwtimerlowvalue: u32, dwtimerhighvalue: u32, ), @@ -3826,11 +3824,11 @@ pub const SECURITY_ANONYMOUS: FILE_FLAGS_AND_ATTRIBUTES = 0u32; #[repr(C)] pub struct SECURITY_ATTRIBUTES { pub nLength: u32, - pub lpSecurityDescriptor: *mut ::core::ffi::c_void, + pub lpSecurityDescriptor: *mut core::ffi::c_void, pub bInheritHandle: BOOL, } -impl ::core::marker::Copy for SECURITY_ATTRIBUTES {} -impl ::core::clone::Clone for SECURITY_ATTRIBUTES { +impl Copy for SECURITY_ATTRIBUTES {} +impl Clone for SECURITY_ATTRIBUTES { fn clone(&self) -> Self { *self } @@ -3849,8 +3847,8 @@ pub struct SOCKADDR { pub sa_family: ADDRESS_FAMILY, pub sa_data: [i8; 14], } -impl ::core::marker::Copy for SOCKADDR {} -impl ::core::clone::Clone for SOCKADDR { +impl Copy for SOCKADDR {} +impl Clone for SOCKADDR { fn clone(&self) -> Self { *self } @@ -3860,8 +3858,8 @@ pub struct SOCKADDR_UN { pub sun_family: ADDRESS_FAMILY, pub sun_path: [i8; 108], } -impl ::core::marker::Copy for SOCKADDR_UN {} -impl ::core::clone::Clone for SOCKADDR_UN { +impl Copy for SOCKADDR_UN {} +impl Clone for SOCKADDR_UN { fn clone(&self) -> Self { *self } @@ -3882,10 +3880,10 @@ pub const SO_SNDTIMEO: i32 = 4101i32; pub const SPECIFIC_RIGHTS_ALL: FILE_ACCESS_RIGHTS = 65535u32; #[repr(C)] pub struct SRWLOCK { - pub Ptr: *mut ::core::ffi::c_void, + pub Ptr: *mut core::ffi::c_void, } -impl ::core::marker::Copy for SRWLOCK {} -impl ::core::clone::Clone for SRWLOCK { +impl Copy for SRWLOCK {} +impl Clone for SRWLOCK { fn clone(&self) -> Self { *self } @@ -3915,8 +3913,8 @@ pub struct STARTUPINFOEXW { pub StartupInfo: STARTUPINFOW, pub lpAttributeList: LPPROC_THREAD_ATTRIBUTE_LIST, } -impl ::core::marker::Copy for STARTUPINFOEXW {} -impl ::core::clone::Clone for STARTUPINFOEXW { +impl Copy for STARTUPINFOEXW {} +impl Clone for STARTUPINFOEXW { fn clone(&self) -> Self { *self } @@ -3942,8 +3940,8 @@ pub struct STARTUPINFOW { pub hStdOutput: HANDLE, pub hStdError: HANDLE, } -impl ::core::marker::Copy for STARTUPINFOW {} -impl ::core::clone::Clone for STARTUPINFOW { +impl Copy for STARTUPINFOW {} +impl Clone for STARTUPINFOW { fn clone(&self) -> Self { *self } @@ -3969,8 +3967,8 @@ pub const SYNCHRONIZE: FILE_ACCESS_RIGHTS = 1048576u32; pub struct SYSTEM_INFO { pub Anonymous: SYSTEM_INFO_0, pub dwPageSize: u32, - pub lpMinimumApplicationAddress: *mut ::core::ffi::c_void, - pub lpMaximumApplicationAddress: *mut ::core::ffi::c_void, + pub lpMinimumApplicationAddress: *mut core::ffi::c_void, + pub lpMaximumApplicationAddress: *mut core::ffi::c_void, pub dwActiveProcessorMask: usize, pub dwNumberOfProcessors: u32, pub dwProcessorType: u32, @@ -3978,8 +3976,8 @@ pub struct SYSTEM_INFO { pub wProcessorLevel: u16, pub wProcessorRevision: u16, } -impl ::core::marker::Copy for SYSTEM_INFO {} -impl ::core::clone::Clone for SYSTEM_INFO { +impl Copy for SYSTEM_INFO {} +impl Clone for SYSTEM_INFO { fn clone(&self) -> Self { *self } @@ -3989,8 +3987,8 @@ pub union SYSTEM_INFO_0 { pub dwOemId: u32, pub Anonymous: SYSTEM_INFO_0_0, } -impl ::core::marker::Copy for SYSTEM_INFO_0 {} -impl ::core::clone::Clone for SYSTEM_INFO_0 { +impl Copy for SYSTEM_INFO_0 {} +impl Clone for SYSTEM_INFO_0 { fn clone(&self) -> Self { *self } @@ -4000,8 +3998,8 @@ pub struct SYSTEM_INFO_0_0 { pub wProcessorArchitecture: PROCESSOR_ARCHITECTURE, pub wReserved: u16, } -impl ::core::marker::Copy for SYSTEM_INFO_0_0 {} -impl ::core::clone::Clone for SYSTEM_INFO_0_0 { +impl Copy for SYSTEM_INFO_0_0 {} +impl Clone for SYSTEM_INFO_0_0 { fn clone(&self) -> Self { *self } @@ -4017,8 +4015,8 @@ pub struct TIMEVAL { pub tv_sec: i32, pub tv_usec: i32, } -impl ::core::marker::Copy for TIMEVAL {} -impl ::core::clone::Clone for TIMEVAL { +impl Copy for TIMEVAL {} +impl Clone for TIMEVAL { fn clone(&self) -> Self { *self } @@ -4054,8 +4052,8 @@ pub struct UNICODE_STRING { pub MaximumLength: u16, pub Buffer: PWSTR, } -impl ::core::marker::Copy for UNICODE_STRING {} -impl ::core::clone::Clone for UNICODE_STRING { +impl Copy for UNICODE_STRING {} +impl Clone for UNICODE_STRING { fn clone(&self) -> Self { *self } @@ -4085,8 +4083,8 @@ pub struct WIN32_FIND_DATAW { pub cFileName: [u16; 260], pub cAlternateFileName: [u16; 14], } -impl ::core::marker::Copy for WIN32_FIND_DATAW {} -impl ::core::clone::Clone for WIN32_FIND_DATAW { +impl Copy for WIN32_FIND_DATAW {} +impl Clone for WIN32_FIND_DATAW { fn clone(&self) -> Self { *self } @@ -4101,8 +4099,8 @@ pub struct WSABUF { pub len: u32, pub buf: PSTR, } -impl ::core::marker::Copy for WSABUF {} -impl ::core::clone::Clone for WSABUF { +impl Copy for WSABUF {} +impl Clone for WSABUF { fn clone(&self) -> Self { *self } @@ -4119,9 +4117,9 @@ pub struct WSADATA { pub szSystemStatus: [i8; 129], } #[cfg(any(target_arch = "aarch64", target_arch = "x86_64"))] -impl ::core::marker::Copy for WSADATA {} +impl Copy for WSADATA {} #[cfg(any(target_arch = "aarch64", target_arch = "x86_64"))] -impl ::core::clone::Clone for WSADATA { +impl Clone for WSADATA { fn clone(&self) -> Self { *self } @@ -4138,9 +4136,9 @@ pub struct WSADATA { pub lpVendorInfo: PSTR, } #[cfg(target_arch = "x86")] -impl ::core::marker::Copy for WSADATA {} +impl Copy for WSADATA {} #[cfg(target_arch = "x86")] -impl ::core::clone::Clone for WSADATA { +impl Clone for WSADATA { fn clone(&self) -> Self { *self } @@ -4204,8 +4202,8 @@ pub struct WSAPROTOCOLCHAIN { pub ChainLen: i32, pub ChainEntries: [u32; 7], } -impl ::core::marker::Copy for WSAPROTOCOLCHAIN {} -impl ::core::clone::Clone for WSAPROTOCOLCHAIN { +impl Copy for WSAPROTOCOLCHAIN {} +impl Clone for WSAPROTOCOLCHAIN { fn clone(&self) -> Self { *self } @@ -4233,8 +4231,8 @@ pub struct WSAPROTOCOL_INFOW { pub dwProviderReserved: u32, pub szProtocol: [u16; 256], } -impl ::core::marker::Copy for WSAPROTOCOL_INFOW {} -impl ::core::clone::Clone for WSAPROTOCOL_INFOW { +impl Copy for WSAPROTOCOL_INFOW {} +impl Clone for WSAPROTOCOL_INFOW { fn clone(&self) -> Self { *self } @@ -4308,9 +4306,9 @@ pub struct XSAVE_FORMAT { pub Reserved4: [u8; 96], } #[cfg(any(target_arch = "aarch64", target_arch = "x86_64"))] -impl ::core::marker::Copy for XSAVE_FORMAT {} +impl Copy for XSAVE_FORMAT {} #[cfg(any(target_arch = "aarch64", target_arch = "x86_64"))] -impl ::core::clone::Clone for XSAVE_FORMAT { +impl Clone for XSAVE_FORMAT { fn clone(&self) -> Self { *self } @@ -4336,9 +4334,9 @@ pub struct XSAVE_FORMAT { pub Reserved4: [u8; 224], } #[cfg(target_arch = "x86")] -impl ::core::marker::Copy for XSAVE_FORMAT {} +impl Copy for XSAVE_FORMAT {} #[cfg(target_arch = "x86")] -impl ::core::clone::Clone for XSAVE_FORMAT { +impl Clone for XSAVE_FORMAT { fn clone(&self) -> Self { *self } diff --git a/src/tools/generate-windows-sys/Cargo.toml b/src/tools/generate-windows-sys/Cargo.toml index ca137211f4ea0..9ea26defdc485 100644 --- a/src/tools/generate-windows-sys/Cargo.toml +++ b/src/tools/generate-windows-sys/Cargo.toml @@ -4,4 +4,4 @@ version = "0.1.0" edition = "2021" [dependencies.windows-bindgen] -version = "0.54.0" +version = "0.55.0" From 6cb2f03c034bacd7fbc916381b0e9a5e5928fdc1 Mon Sep 17 00:00:00 2001 From: Chris Denton Date: Thu, 7 Mar 2024 16:12:40 +0000 Subject: [PATCH 05/11] Convert [u8] to [i8] in test --- library/std/src/fs/tests.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/library/std/src/fs/tests.rs b/library/std/src/fs/tests.rs index a65e78542bf20..65dec3863cc69 100644 --- a/library/std/src/fs/tests.rs +++ b/library/std/src/fs/tests.rs @@ -1782,6 +1782,7 @@ fn windows_unix_socket_exists() { } let mut addr = c::SOCKADDR_UN { sun_family: c::AF_UNIX, sun_path: mem::zeroed() }; let bytes = socket_path.as_os_str().as_encoded_bytes(); + let bytes = core::slice::from_raw_parts(bytes.as_ptr().cast::(), bytes.len()); addr.sun_path[..bytes.len()].copy_from_slice(bytes); let len = mem::size_of_val(&addr) as i32; let result = c::bind(socket, ptr::addr_of!(addr).cast::(), len); From f2abc7f853377800030d7f4df50d990865868745 Mon Sep 17 00:00:00 2001 From: Chris Denton Date: Tue, 12 Mar 2024 18:41:16 +0000 Subject: [PATCH 06/11] Check all tier 1 targets in PR CI --- src/ci/docker/host-x86_64/mingw-check/Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/ci/docker/host-x86_64/mingw-check/Dockerfile b/src/ci/docker/host-x86_64/mingw-check/Dockerfile index 30d3a52d82b82..1b57b54e483e1 100644 --- a/src/ci/docker/host-x86_64/mingw-check/Dockerfile +++ b/src/ci/docker/host-x86_64/mingw-check/Dockerfile @@ -41,6 +41,8 @@ COPY host-x86_64/mingw-check/validate-error-codes.sh /scripts/ ENV RUN_CHECK_WITH_PARALLEL_QUERIES 1 ENV SCRIPT python3 ../x.py --stage 2 test src/tools/expand-yaml-anchors && \ + # check library crates on all tier 1 targets + python3 ../x.py check --stage 0 --set build.optimized-compiler-builtins=false core alloc std --target=aarch64-unknown-linux-gnu,i686-pc-windows-msvc,i686-unknown-linux-gnu,x86_64-apple-darwin,x86_64-pc-windows-gnu,x86_64-pc-windows-msvc && \ python3 ../x.py check --target=i686-pc-windows-gnu --host=i686-pc-windows-gnu && \ python3 ../x.py clippy compiler -Aclippy::all -Dclippy::correctness && \ python3 ../x.py build --stage 0 src/tools/build-manifest && \ From d5e5ef5c8958d3e59969652821d3cd0b8e185345 Mon Sep 17 00:00:00 2001 From: Chris Denton Date: Thu, 14 Mar 2024 06:52:40 +0000 Subject: [PATCH 07/11] Add comments explaining tier 1 PR checks --- src/ci/docker/host-x86_64/mingw-check/Dockerfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ci/docker/host-x86_64/mingw-check/Dockerfile b/src/ci/docker/host-x86_64/mingw-check/Dockerfile index 1b57b54e483e1..e5aa81d83d5a1 100644 --- a/src/ci/docker/host-x86_64/mingw-check/Dockerfile +++ b/src/ci/docker/host-x86_64/mingw-check/Dockerfile @@ -41,7 +41,9 @@ COPY host-x86_64/mingw-check/validate-error-codes.sh /scripts/ ENV RUN_CHECK_WITH_PARALLEL_QUERIES 1 ENV SCRIPT python3 ../x.py --stage 2 test src/tools/expand-yaml-anchors && \ - # check library crates on all tier 1 targets + # Check library crates on all tier 1 targets. + # We disable optimized compiler built-ins because that requires a C toolchain for the target. + # We also skip the x86_64-unknown-linux-gnu target as it is well-tested by other jobs. python3 ../x.py check --stage 0 --set build.optimized-compiler-builtins=false core alloc std --target=aarch64-unknown-linux-gnu,i686-pc-windows-msvc,i686-unknown-linux-gnu,x86_64-apple-darwin,x86_64-pc-windows-gnu,x86_64-pc-windows-msvc && \ python3 ../x.py check --target=i686-pc-windows-gnu --host=i686-pc-windows-gnu && \ python3 ../x.py clippy compiler -Aclippy::all -Dclippy::correctness && \ From 39e36af85620ab5f3344a2ec5f838b2c3d68eab6 Mon Sep 17 00:00:00 2001 From: clubby789 Date: Thu, 14 Mar 2024 11:24:09 +0000 Subject: [PATCH 08/11] Bump `cargo update` PR more often --- .github/workflows/dependencies.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dependencies.yml b/.github/workflows/dependencies.yml index 97ed891c491da..c182f3245e5d8 100644 --- a/.github/workflows/dependencies.yml +++ b/.github/workflows/dependencies.yml @@ -6,6 +6,8 @@ on: schedule: # Run weekly - cron: '0 0 * * Sun' + # Re-bump deps every 4 hours + - cron: '0 */4 * * *' workflow_dispatch: # Needed so we can run it manually permissions: @@ -135,8 +137,8 @@ jobs: gh pr edit cargo_update --title "${PR_TITLE}" --body-file body.md --repo $GITHUB_REPOSITORY - name: open new pull request - # Only run if there wasn't an existing PR - if: steps.edit.outcome != 'success' + # Only run if there wasn't an existing PR and if this is the weekly run + if: steps.edit.outcome != 'success' && github.event.schedule == '0 0 * * Sun' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: gh pr create --title "${PR_TITLE}" --body-file body.md --repo $GITHUB_REPOSITORY From b0b249399a97e7f3ac97996f26993bf67fc9bfba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20K=C3=A5re=20Alsaker?= Date: Sat, 16 Mar 2024 06:00:05 +0100 Subject: [PATCH 09/11] Use `UnsafeCell` for fast constant thread locals --- library/std/src/sys/thread_local/fast_local.rs | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/library/std/src/sys/thread_local/fast_local.rs b/library/std/src/sys/thread_local/fast_local.rs index 646dcd7f3a3e8..69ee70de30c02 100644 --- a/library/std/src/sys/thread_local/fast_local.rs +++ b/library/std/src/sys/thread_local/fast_local.rs @@ -13,22 +13,21 @@ pub macro thread_local_inner { (@key $t:ty, const $init:expr) => {{ #[inline] #[deny(unsafe_op_in_unsafe_fn)] - // FIXME: Use `SyncUnsafeCell` instead of allowing `static_mut_refs` lint - #[cfg_attr(bootstrap, allow(static_mut_ref))] - #[cfg_attr(not(bootstrap), allow(static_mut_refs))] unsafe fn __getit( _init: $crate::option::Option<&mut $crate::option::Option<$t>>, ) -> $crate::option::Option<&'static $t> { const INIT_EXPR: $t = $init; // If the platform has support for `#[thread_local]`, use it. #[thread_local] - static mut VAL: $t = INIT_EXPR; + // We use `UnsafeCell` here instead of `static mut` to ensure any generated TLS shims + // have a nonnull attribute on their return value. + static VAL: $crate::cell::UnsafeCell<$t> = $crate::cell::UnsafeCell::new(INIT_EXPR); // If a dtor isn't needed we can do something "very raw" and // just get going. if !$crate::mem::needs_drop::<$t>() { unsafe { - return $crate::option::Option::Some(&VAL) + return $crate::option::Option::Some(&*VAL.get()) } } @@ -55,15 +54,15 @@ pub macro thread_local_inner { // so now. 0 => { $crate::thread::local_impl::Key::<$t>::register_dtor( - $crate::ptr::addr_of_mut!(VAL) as *mut $crate::primitive::u8, + VAL.get() as *mut $crate::primitive::u8, destroy, ); STATE.set(1); - $crate::option::Option::Some(&VAL) + $crate::option::Option::Some(&*VAL.get()) } // 1 == the destructor is registered and the value // is valid, so return the pointer. - 1 => $crate::option::Option::Some(&VAL), + 1 => $crate::option::Option::Some(&*VAL.get()), // otherwise the destructor has already run, so we // can't give access. _ => $crate::option::Option::None, From 0ec5d374fe901488c9bd73cd2162bd62daca8261 Mon Sep 17 00:00:00 2001 From: Nilstrieb <48135649+Nilstrieb@users.noreply.github.com> Date: Sat, 16 Mar 2024 12:24:49 +0100 Subject: [PATCH 10/11] bootstrap: Don't name things copy that are not copies The bootstrap copy methods don't actually copy, they just hard link. Simply lying about it being "copying" can be very confusing! (ask me how I know!). --- src/bootstrap/src/core/build_steps/compile.rs | 41 ++++++++-------- src/bootstrap/src/core/build_steps/dist.rs | 29 +++++------ src/bootstrap/src/core/build_steps/doc.rs | 9 ++-- src/bootstrap/src/core/build_steps/test.rs | 2 +- src/bootstrap/src/core/build_steps/tool.rs | 8 ++-- src/bootstrap/src/lib.rs | 48 ++++++++++++------- src/bootstrap/src/utils/tarball.rs | 4 +- 7 files changed, 79 insertions(+), 62 deletions(-) diff --git a/src/bootstrap/src/core/build_steps/compile.rs b/src/bootstrap/src/core/build_steps/compile.rs index 94ea2a01a4057..e927b491c71ea 100644 --- a/src/bootstrap/src/core/build_steps/compile.rs +++ b/src/bootstrap/src/core/build_steps/compile.rs @@ -231,7 +231,7 @@ impl Step for Std { let target_sysroot_bin = builder.sysroot_libdir(compiler, target).parent().unwrap().join("bin"); t!(fs::create_dir_all(&target_sysroot_bin)); - builder.cp_r(&src_sysroot_bin, &target_sysroot_bin); + builder.cp_link_r(&src_sysroot_bin, &target_sysroot_bin); } } @@ -307,7 +307,7 @@ fn copy_and_stamp( dependency_type: DependencyType, ) { let target = libdir.join(name); - builder.copy(&sourcedir.join(name), &target); + builder.copy_link(&sourcedir.join(name), &target); target_deps.push((target, dependency_type)); } @@ -316,7 +316,7 @@ fn copy_llvm_libunwind(builder: &Builder<'_>, target: TargetSelection, libdir: & let libunwind_path = builder.ensure(llvm::Libunwind { target }); let libunwind_source = libunwind_path.join("libunwind.a"); let libunwind_target = libdir.join("libunwind.a"); - builder.copy(&libunwind_source, &libunwind_target); + builder.copy_link(&libunwind_source, &libunwind_target); libunwind_target } @@ -385,7 +385,7 @@ fn copy_self_contained_objects( for &obj in &["crtbegin.o", "crtbeginS.o", "crtend.o", "crtendS.o"] { let src = crt_path.join(obj); let target = libdir_self_contained.join(obj); - builder.copy(&src, &target); + builder.copy_link(&src, &target); target_deps.push((target, DependencyType::TargetSelfContained)); } @@ -418,7 +418,7 @@ fn copy_self_contained_objects( for obj in ["crt2.o", "dllcrt2.o"].iter() { let src = compiler_file(builder, &builder.cc(target), target, CLang::C, obj); let target = libdir_self_contained.join(obj); - builder.copy(&src, &target); + builder.copy_link(&src, &target); target_deps.push((target, DependencyType::TargetSelfContained)); } } @@ -637,7 +637,7 @@ impl Step for StdLink { let stage0_bin_dir = builder.out.join(host).join("stage0/bin"); let sysroot_bin_dir = sysroot.join("bin"); t!(fs::create_dir_all(&sysroot_bin_dir)); - builder.cp_r(&stage0_bin_dir, &sysroot_bin_dir); + builder.cp_link_r(&stage0_bin_dir, &sysroot_bin_dir); // Copy all *.so files from stage0/lib to stage0-sysroot/lib let stage0_lib_dir = builder.out.join(host).join("stage0/lib"); @@ -646,7 +646,8 @@ impl Step for StdLink { let file = t!(file); let path = file.path(); if path.is_file() && is_dylib(&file.file_name().into_string().unwrap()) { - builder.copy(&path, &sysroot.join("lib").join(path.file_name().unwrap())); + builder + .copy_link(&path, &sysroot.join("lib").join(path.file_name().unwrap())); } } } @@ -661,7 +662,7 @@ impl Step for StdLink { .join(host) .join("codegen-backends"); if stage0_codegen_backends.exists() { - builder.cp_r(&stage0_codegen_backends, &sysroot_codegen_backends); + builder.cp_link_r(&stage0_codegen_backends, &sysroot_codegen_backends); } } } @@ -684,7 +685,7 @@ fn copy_sanitizers( for runtime in &runtimes { let dst = libdir.join(&runtime.name); - builder.copy(&runtime.path, &dst); + builder.copy_link(&runtime.path, &dst); // The `aarch64-apple-ios-macabi` and `x86_64-apple-ios-macabi` are also supported for // sanitizers, but they share a sanitizer runtime with `${arch}-apple-darwin`, so we do @@ -790,7 +791,7 @@ impl Step for StartupObjects { } let target = sysroot_dir.join((*file).to_string() + ".o"); - builder.copy(dst_file, &target); + builder.copy_link(dst_file, &target); target_deps.push((target, DependencyType::Target)); } @@ -812,7 +813,7 @@ fn cp_rustc_component_to_ci_sysroot( if src.is_dir() { t!(fs::create_dir_all(dst)); } else { - builder.copy(&src, &dst); + builder.copy_link(&src, &dst); } } } @@ -1443,7 +1444,7 @@ fn copy_codegen_backends_to_sysroot( let dot = filename.find('.').unwrap(); format!("{}-{}{}", &filename[..dash], builder.rust_release(), &filename[dot..]) }; - builder.copy(file, &dst.join(target_filename)); + builder.copy_link(file, &dst.join(target_filename)); } } @@ -1599,7 +1600,7 @@ impl Step for Sysroot { OsStr::new(std::env::consts::DLL_EXTENSION), ]; let ci_rustc_dir = builder.config.ci_rustc_dir(); - builder.cp_filtered(&ci_rustc_dir, &sysroot, &|path| { + builder.cp_link_filtered(&ci_rustc_dir, &sysroot, &|path| { if path.extension().map_or(true, |ext| !filtered_extensions.contains(&ext)) { return true; } @@ -1791,7 +1792,7 @@ impl Step for Assemble { let filename = f.file_name().into_string().unwrap(); if (is_dylib(&filename) || is_debug_info(&filename)) && !proc_macros.contains(&filename) { - builder.copy(&f.path(), &rustc_libdir.join(&filename)); + builder.copy_link(&f.path(), &rustc_libdir.join(&filename)); } } @@ -1805,7 +1806,7 @@ impl Step for Assemble { if let Some(lld_install) = lld_install { let src_exe = exe("lld", target_compiler.host); let dst_exe = exe("rust-lld", target_compiler.host); - builder.copy(&lld_install.join("bin").join(src_exe), &libdir_bin.join(dst_exe)); + builder.copy_link(&lld_install.join("bin").join(src_exe), &libdir_bin.join(dst_exe)); let self_contained_lld_dir = libdir_bin.join("gcc-ld"); t!(fs::create_dir_all(&self_contained_lld_dir)); let lld_wrapper_exe = builder.ensure(crate::core::build_steps::tool::LldWrapper { @@ -1813,7 +1814,7 @@ impl Step for Assemble { target: target_compiler.host, }); for name in crate::LLD_FILE_NAMES { - builder.copy( + builder.copy_link( &lld_wrapper_exe, &self_contained_lld_dir.join(exe(name, target_compiler.host)), ); @@ -1838,7 +1839,7 @@ impl Step for Assemble { // When using `download-ci-llvm`, some of the tools // may not exist, so skip trying to copy them. if src_path.exists() { - builder.copy(&src_path, &libdir_bin.join(&tool_exe)); + builder.copy_link(&src_path, &libdir_bin.join(&tool_exe)); } } } @@ -1851,7 +1852,7 @@ impl Step for Assemble { extra_features: vec![], }); let tool_exe = exe("llvm-bitcode-linker", target_compiler.host); - builder.copy(&src_path, &libdir_bin.join(&tool_exe)); + builder.copy_link(&src_path, &libdir_bin.join(&tool_exe)); } // Ensure that `libLLVM.so` ends up in the newly build compiler directory, @@ -1865,7 +1866,7 @@ impl Step for Assemble { let bindir = sysroot.join("bin"); t!(fs::create_dir_all(bindir)); let compiler = builder.rustc(target_compiler); - builder.copy(&rustc, &compiler); + builder.copy_link(&rustc, &compiler); target_compiler } @@ -1891,7 +1892,7 @@ pub fn add_to_sysroot( DependencyType::Target => sysroot_dst, DependencyType::TargetSelfContained => self_contained_dst, }; - builder.copy(&path, &dst.join(path.file_name().unwrap())); + builder.copy_link(&path, &dst.join(path.file_name().unwrap())); } } diff --git a/src/bootstrap/src/core/build_steps/dist.rs b/src/bootstrap/src/core/build_steps/dist.rs index 3efdfc324b86c..012d64e534439 100644 --- a/src/bootstrap/src/core/build_steps/dist.rs +++ b/src/bootstrap/src/core/build_steps/dist.rs @@ -272,7 +272,7 @@ fn make_win_dist( let dist_bin_dir = rust_root.join("bin/"); fs::create_dir_all(&dist_bin_dir).expect("creating dist_bin_dir failed"); for src in rustc_dlls { - builder.copy_to_folder(&src, &dist_bin_dir); + builder.copy_link_to_folder(&src, &dist_bin_dir); } //Copy platform tools to platform-specific bin directory @@ -284,7 +284,7 @@ fn make_win_dist( .join("self-contained"); fs::create_dir_all(&target_bin_dir).expect("creating target_bin_dir failed"); for src in target_tools { - builder.copy_to_folder(&src, &target_bin_dir); + builder.copy_link_to_folder(&src, &target_bin_dir); } // Warn windows-gnu users that the bundled GCC cannot compile C files @@ -304,7 +304,7 @@ fn make_win_dist( .join("self-contained"); fs::create_dir_all(&target_lib_dir).expect("creating target_lib_dir failed"); for src in target_libs { - builder.copy_to_folder(&src, &target_lib_dir); + builder.copy_link_to_folder(&src, &target_lib_dir); } } @@ -400,7 +400,7 @@ impl Step for Rustc { // Copy rustc binary t!(fs::create_dir_all(image.join("bin"))); - builder.cp_r(&src.join("bin"), &image.join("bin")); + builder.cp_link_r(&src.join("bin"), &image.join("bin")); // If enabled, copy rustdoc binary if builder @@ -458,13 +458,13 @@ impl Step for Rustc { if builder.config.lld_enabled { let src_dir = builder.sysroot_libdir(compiler, host).parent().unwrap().join("bin"); let rust_lld = exe("rust-lld", compiler.host); - builder.copy(&src_dir.join(&rust_lld), &dst_dir.join(&rust_lld)); + builder.copy_link(&src_dir.join(&rust_lld), &dst_dir.join(&rust_lld)); let self_contained_lld_src_dir = src_dir.join("gcc-ld"); let self_contained_lld_dst_dir = dst_dir.join("gcc-ld"); t!(fs::create_dir(&self_contained_lld_dst_dir)); for name in crate::LLD_FILE_NAMES { let exe_name = exe(name, compiler.host); - builder.copy( + builder.copy_link( &self_contained_lld_src_dir.join(&exe_name), &self_contained_lld_dst_dir.join(&exe_name), ); @@ -609,9 +609,9 @@ fn copy_target_libs(builder: &Builder<'_>, target: TargetSelection, image: &Path t!(fs::create_dir_all(&self_contained_dst)); for (path, dependency_type) in builder.read_stamp_file(stamp) { if dependency_type == DependencyType::TargetSelfContained { - builder.copy(&path, &self_contained_dst.join(path.file_name().unwrap())); + builder.copy_link(&path, &self_contained_dst.join(path.file_name().unwrap())); } else if dependency_type == DependencyType::Target || builder.config.build == target { - builder.copy(&path, &dst.join(path.file_name().unwrap())); + builder.copy_link(&path, &dst.join(path.file_name().unwrap())); } } } @@ -865,7 +865,8 @@ fn copy_src_dirs( for item in src_dirs { let dst = &dst_dir.join(item); t!(fs::create_dir_all(dst)); - builder.cp_filtered(&base.join(item), dst, &|path| filter_fn(exclude_dirs, item, path)); + builder + .cp_link_filtered(&base.join(item), dst, &|path| filter_fn(exclude_dirs, item, path)); } } @@ -923,7 +924,7 @@ impl Step for Src { &dst_src, ); for file in src_files.iter() { - builder.copy(&builder.src.join(file), &dst_src.join(file)); + builder.copy_link(&builder.src.join(file), &dst_src.join(file)); } tarball.generate() @@ -979,7 +980,7 @@ impl Step for PlainSourceTarball { // Copy the files normally for item in &src_files { - builder.copy(&builder.src.join(item), &plain_dst_src.join(item)); + builder.copy_link(&builder.src.join(item), &plain_dst_src.join(item)); } // Create the version file @@ -1608,7 +1609,7 @@ impl Step for Extended { let prepare = |name: &str| { builder.create_dir(&pkg.join(name)); - builder.cp_r( + builder.cp_link_r( &work.join(format!("{}-{}", pkgname(builder, name), target.triple)), &pkg.join(name), ); @@ -1672,7 +1673,7 @@ impl Step for Extended { } else { name.to_string() }; - builder.cp_r( + builder.cp_link_r( &work.join(format!("{}-{}", pkgname(builder, name), target.triple)).join(dir), &exe.join(name), ); @@ -2040,7 +2041,7 @@ fn install_llvm_file( if install_symlink { // For download-ci-llvm, also install the symlink, to match what LLVM does. Using a // symlink is fine here, as this is not a rustup component. - builder.copy(&source, &full_dest); + builder.copy_link(&source, &full_dest); } else { // Otherwise, replace the symlink with an equivalent linker script. This is used when // projects like miri link against librustc_driver.so. We don't use a symlink, as diff --git a/src/bootstrap/src/core/build_steps/doc.rs b/src/bootstrap/src/core/build_steps/doc.rs index 1d4d9d4c2e1be..51b5cdc056577 100644 --- a/src/bootstrap/src/core/build_steps/doc.rs +++ b/src/bootstrap/src/core/build_steps/doc.rs @@ -520,7 +520,10 @@ impl Step for SharedAssets { t!(fs::write(&version_info, info)); } - builder.copy(&builder.src.join("src").join("doc").join("rust.css"), &out.join("rust.css")); + builder.copy_link( + &builder.src.join("src").join("doc").join("rust.css"), + &out.join("rust.css"), + ); SharedAssetsPaths { version_info } } @@ -718,7 +721,7 @@ fn doc_std( let _guard = builder.msg_doc(compiler, description, target); builder.run(&mut cargo.into()); - builder.cp_r(&out_dir, out); + builder.cp_link_r(&out_dir, out); } #[derive(Debug, Clone, Hash, PartialEq, Eq)] @@ -1151,7 +1154,7 @@ impl Step for RustcBook { let out_base = builder.md_doc_out(self.target).join("rustc"); t!(fs::create_dir_all(&out_base)); let out_listing = out_base.join("src/lints"); - builder.cp_r(&builder.src.join("src/doc/rustc"), &out_base); + builder.cp_link_r(&builder.src.join("src/doc/rustc"), &out_base); builder.info(&format!("Generating lint docs ({})", self.target)); let rustc = builder.rustc(self.compiler); diff --git a/src/bootstrap/src/core/build_steps/test.rs b/src/bootstrap/src/core/build_steps/test.rs index e9e2a881d111d..690e20fb6b978 100644 --- a/src/bootstrap/src/core/build_steps/test.rs +++ b/src/bootstrap/src/core/build_steps/test.rs @@ -1367,7 +1367,7 @@ impl Step for RunMakeSupport { let cargo_out = builder.cargo_out(self.compiler, Mode::ToolStd, self.target).join(&lib_name); - builder.copy(&cargo_out, &lib); + builder.copy_link(&cargo_out, &lib); lib } } diff --git a/src/bootstrap/src/core/build_steps/tool.rs b/src/bootstrap/src/core/build_steps/tool.rs index 53dc1cff0aeba..3c20011210373 100644 --- a/src/bootstrap/src/core/build_steps/tool.rs +++ b/src/bootstrap/src/core/build_steps/tool.rs @@ -127,7 +127,7 @@ impl Step for ToolBuild { } let cargo_out = builder.cargo_out(compiler, self.mode, target).join(exe(tool, target)); let bin = builder.tools_dir(compiler).join(exe(tool, target)); - builder.copy(&cargo_out, &bin); + builder.copy_link(&cargo_out, &bin); bin } } @@ -507,7 +507,7 @@ impl Step for Rustdoc { t!(fs::create_dir_all(&bindir)); let bin_rustdoc = bindir.join(exe("rustdoc", target_compiler.host)); let _ = fs::remove_file(&bin_rustdoc); - builder.copy(&tool_rustdoc, &bin_rustdoc); + builder.copy_link(&tool_rustdoc, &bin_rustdoc); bin_rustdoc } else { tool_rustdoc @@ -686,7 +686,7 @@ impl Step for RustAnalyzerProcMacroSrv { // so that r-a can use it. let libexec_path = builder.sysroot(self.compiler).join("libexec"); t!(fs::create_dir_all(&libexec_path)); - builder.copy(&path, &libexec_path.join("rust-analyzer-proc-macro-srv")); + builder.copy_link(&path, &libexec_path.join("rust-analyzer-proc-macro-srv")); Some(path) } @@ -765,7 +765,7 @@ macro_rules! tool_extended { $(for add_bin in $add_bins_to_sysroot { let bin_source = tools_out.join(exe(add_bin, $sel.target)); let bin_destination = bindir.join(exe(add_bin, $sel.compiler.host)); - $builder.copy(&bin_source, &bin_destination); + $builder.copy_link(&bin_source, &bin_destination); })? let tool = bindir.join(exe($tool_name, $sel.compiler.host)); diff --git a/src/bootstrap/src/lib.rs b/src/bootstrap/src/lib.rs index 85211aabb74c4..ea25015ba2719 100644 --- a/src/bootstrap/src/lib.rs +++ b/src/bootstrap/src/lib.rs @@ -1646,16 +1646,19 @@ impl Build { paths } - /// Copies a file from `src` to `dst` - pub fn copy(&self, src: &Path, dst: &Path) { - self.copy_internal(src, dst, false); + /// Links a file from `src` to `dst`. + /// Attempts to use hard links if possible, falling back to copying. + /// You can neither rely on this being a copy nor it being a link, + /// so do not write to dst. + pub fn copy_link(&self, src: &Path, dst: &Path) { + self.copy_link_internal(src, dst, false); } - fn copy_internal(&self, src: &Path, dst: &Path, dereference_symlinks: bool) { + fn copy_link_internal(&self, src: &Path, dst: &Path, dereference_symlinks: bool) { if self.config.dry_run() { return; } - self.verbose_than(1, || println!("Copy {src:?} to {dst:?}")); + self.verbose_than(1, || println!("Copy/Link {src:?} to {dst:?}")); if src == dst { return; } @@ -1686,9 +1689,10 @@ impl Build { } } - /// Copies the `src` directory recursively to `dst`. Both are assumed to exist + /// Links the `src` directory recursively to `dst`. Both are assumed to exist /// when this function is called. - pub fn cp_r(&self, src: &Path, dst: &Path) { + /// Will attempt to use hard links if possible and fall back to copying. + pub fn cp_link_r(&self, src: &Path, dst: &Path) { if self.config.dry_run() { return; } @@ -1698,24 +1702,32 @@ impl Build { let dst = dst.join(name); if t!(f.file_type()).is_dir() { t!(fs::create_dir_all(&dst)); - self.cp_r(&path, &dst); + self.cp_link_r(&path, &dst); } else { let _ = fs::remove_file(&dst); - self.copy(&path, &dst); + self.copy_link(&path, &dst); } } } /// Copies the `src` directory recursively to `dst`. Both are assumed to exist - /// when this function is called. Unwanted files or directories can be skipped + /// when this function is called. + /// Will attempt to use hard links if possible and fall back to copying. + /// Unwanted files or directories can be skipped /// by returning `false` from the filter function. - pub fn cp_filtered(&self, src: &Path, dst: &Path, filter: &dyn Fn(&Path) -> bool) { + pub fn cp_link_filtered(&self, src: &Path, dst: &Path, filter: &dyn Fn(&Path) -> bool) { // Immediately recurse with an empty relative path - self.recurse_(src, dst, Path::new(""), filter) + self.cp_link_filtered_recurse(src, dst, Path::new(""), filter) } // Inner function does the actual work - fn recurse_(&self, src: &Path, dst: &Path, relative: &Path, filter: &dyn Fn(&Path) -> bool) { + fn cp_link_filtered_recurse( + &self, + src: &Path, + dst: &Path, + relative: &Path, + filter: &dyn Fn(&Path) -> bool, + ) { for f in self.read_dir(src) { let path = f.path(); let name = path.file_name().unwrap(); @@ -1726,19 +1738,19 @@ impl Build { if t!(f.file_type()).is_dir() { let _ = fs::remove_dir_all(&dst); self.create_dir(&dst); - self.recurse_(&path, &dst, &relative, filter); + self.cp_link_filtered_recurse(&path, &dst, &relative, filter); } else { let _ = fs::remove_file(&dst); - self.copy(&path, &dst); + self.copy_link(&path, &dst); } } } } - fn copy_to_folder(&self, src: &Path, dest_folder: &Path) { + fn copy_link_to_folder(&self, src: &Path, dest_folder: &Path) { let file_name = src.file_name().unwrap(); let dest = dest_folder.join(file_name); - self.copy(src, &dest); + self.copy_link(src, &dest); } fn install(&self, src: &Path, dstdir: &Path, perms: u32) { @@ -1751,7 +1763,7 @@ impl Build { if !src.exists() { panic!("ERROR: File \"{}\" not found!", src.display()); } - self.copy_internal(src, &dst, true); + self.copy_link_internal(src, &dst, true); chmod(&dst, perms); } diff --git a/src/bootstrap/src/utils/tarball.rs b/src/bootstrap/src/utils/tarball.rs index 03f56cba29d8d..4f99079a57f36 100644 --- a/src/bootstrap/src/utils/tarball.rs +++ b/src/bootstrap/src/utils/tarball.rs @@ -197,7 +197,7 @@ impl<'a> Tarball<'a> { ) { let destdir = self.image_dir.join(destdir.as_ref()); t!(std::fs::create_dir_all(&destdir)); - self.builder.copy(src.as_ref(), &destdir.join(new_name)); + self.builder.copy_link(src.as_ref(), &destdir.join(new_name)); } pub(crate) fn add_legal_and_readme_to(&self, destdir: impl AsRef) { @@ -210,7 +210,7 @@ impl<'a> Tarball<'a> { let dest = self.image_dir.join(dest.as_ref()); t!(std::fs::create_dir_all(&dest)); - self.builder.cp_r(src.as_ref(), &dest); + self.builder.cp_link_r(src.as_ref(), &dest); } pub(crate) fn add_bulk_dir(&mut self, src: impl AsRef, dest: impl AsRef) { From 52f84fa7c2a1c096bda71475e4e3007110a60887 Mon Sep 17 00:00:00 2001 From: Nilstrieb <48135649+Nilstrieb@users.noreply.github.com> Date: Sat, 16 Mar 2024 12:57:36 +0100 Subject: [PATCH 11/11] Remove double remove_file --- src/bootstrap/src/lib.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/bootstrap/src/lib.rs b/src/bootstrap/src/lib.rs index ea25015ba2719..f0fe994d155d0 100644 --- a/src/bootstrap/src/lib.rs +++ b/src/bootstrap/src/lib.rs @@ -1704,7 +1704,6 @@ impl Build { t!(fs::create_dir_all(&dst)); self.cp_link_r(&path, &dst); } else { - let _ = fs::remove_file(&dst); self.copy_link(&path, &dst); } }