Auto merge of #122602 - ChrisDenton:rollup-f0vumtg, r=ChrisDenton
Rollup of 7 pull requests Successful merges: - #122323 (configure.py: add flag for loongarch64 musl-root) - #122372 (prevent notifying the same changes more than once) - #122390 (Bump windows-bindgen to 0.55.0) - #122401 (Check library crates for all tier 1 targets in PR CI) - #122489 (Bump `cargo update` PR more often) - #122583 (Use `UnsafeCell` for fast constant thread locals) - #122590 (bootstrap: Don't name things copy that are not copies) r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
766bdce744
16 changed files with 330 additions and 296 deletions
6
.github/workflows/dependencies.yml
vendored
6
.github/workflows/dependencies.yml
vendored
|
@ -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
|
||||
|
|
10
Cargo.lock
10
Cargo.lock
|
@ -6280,12 +6280,14 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "windows-bindgen"
|
||||
version = "0.52.0"
|
||||
version = "0.55.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "970efb0b6849eb8a87a898f586af7cc167567b070014c7434514c0bde0ca341c"
|
||||
checksum = "073ff8a486ebad239d557809d2cd5fe5e04ee1de29e09c6cd83fb0bae19b8a4c"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"rayon",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"syn 2.0.52",
|
||||
"windows-metadata",
|
||||
]
|
||||
|
@ -6301,9 +6303,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "windows-metadata"
|
||||
version = "0.52.0"
|
||||
version = "0.55.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "218fd59201e26acdbb894fa2b302d1de84bf3eec7d0eb894ac8e9c5a854ee4ef"
|
||||
checksum = "b602635050172a1fc57a35040d4d225baefc6098fefd97094919921d95961a7d"
|
||||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
|
|
|
@ -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::<i8>(), 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::<c::SOCKADDR>(), len);
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -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,
|
||||
|
|
|
@ -131,6 +131,8 @@ v("musl-root-riscv32gc", "target.riscv32gc-unknown-linux-musl.musl-root",
|
|||
"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",
|
||||
|
|
|
@ -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<String> {
|
|||
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);
|
||||
|
||||
|
|
|
@ -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()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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,31 @@ 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 +1737,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 +1762,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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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<Path>) {
|
||||
|
@ -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<Path>, dest: impl AsRef<Path>) {
|
||||
|
|
|
@ -41,6 +41,10 @@ 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.
|
||||
# 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 && \
|
||||
python3 ../x.py build --stage 0 src/tools/build-manifest && \
|
||||
|
|
|
@ -4,4 +4,4 @@ version = "0.1.0"
|
|||
edition = "2021"
|
||||
|
||||
[dependencies.windows-bindgen]
|
||||
version = "0.52.0"
|
||||
version = "0.55.0"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue