Skip to content
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
970ac40
updated doc comment
Kivooeo Aug 2, 2025
8fb98ef
mbe: Parse macro `derive` rules
joshtriplett Aug 9, 2025
354fcf2
mbe: Handle applying `macro_rules` derives
joshtriplett Aug 10, 2025
c64c6d8
Use `LLVMSetTailCallKind`
Zalathar Aug 14, 2025
51bccdd
Port `#[custom_mir(..)]` to the new attribute system
scrabsha Aug 10, 2025
e193b53
Use `LLVMGetTypeKind`
Zalathar Aug 14, 2025
1d00627
add static glibc to the nix dev shell
WaffleLapkin Aug 15, 2025
8511e40
rustdoc-search: search backend with partitioned suffix tree
notriddle Nov 22, 2024
9fab380
Fix typo in doc for library/std/src/fs.rs#set_permissions
alurm Aug 15, 2025
5107ac9
Do not call `fs::remove_file` in `cp_link_filtered_recurse`
Kobzol Aug 15, 2025
cdea62d
Optimize `copy_src_dirs`
Kobzol Aug 15, 2025
e8f90b1
Don't show foreign types as an allowed target if the feature is not e…
JonathanBrouwer Aug 16, 2025
a69ba29
Fix deprecation attribute on foreign statics & types
JonathanBrouwer Aug 16, 2025
05dfcc9
Rollup merge of #144476 - notriddle:notriddle/stringdex, r=lolbinaryc…
Zalathar Aug 17, 2025
bbdcc8d
Rollup merge of #144838 - Kivooeo:doc-subtype, r=notriddle
Zalathar Aug 17, 2025
5dfe17f
Rollup merge of #145206 - scrabsha:push-uxovoqzrxnlx, r=jdonszelmann
Zalathar Aug 17, 2025
3ed9c10
Rollup merge of #145208 - joshtriplett:mbe-derive, r=petrochenkov
Zalathar Aug 17, 2025
1956eb2
Rollup merge of #145420 - Zalathar:llvm-c, r=WaffleLapkin
Zalathar Aug 17, 2025
b286f01
Rollup merge of #145451 - WaffleLapkin:norailoveyou, r=Noratrieb
Zalathar Aug 17, 2025
54d2396
Rollup merge of #145460 - Kobzol:bootstrap-speedup-copy-src-dirs, r=j…
Zalathar Aug 17, 2025
7b4ab9c
Rollup merge of #145476 - alurm:patch-1, r=ibraheemdev
Zalathar Aug 17, 2025
453e4fd
Rollup merge of #145485 - JonathanBrouwer:fix-deprecation-targets, r=…
Zalathar Aug 17, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 42 additions & 39 deletions src/bootstrap/src/core/build_steps/dist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -916,79 +916,74 @@ fn copy_src_dirs(
exclude_dirs: &[&str],
dst_dir: &Path,
) {
// The src directories should be relative to `base`, we depend on them not being absolute
// paths below.
for src_dir in src_dirs {
assert!(Path::new(src_dir).is_relative());
}

// Iterating, filtering and copying a large number of directories can be quite slow.
// Avoid doing it in dry run (and thus also tests).
if builder.config.dry_run() {
return;
}

fn filter_fn(exclude_dirs: &[&str], dir: &str, path: &Path) -> bool {
// The paths are relative, e.g. `llvm-project/...`.
let spath = match path.to_str() {
Some(path) => path,
None => return false,
};
if spath.ends_with('~') || spath.ends_with(".pyc") {
return false;
}
// Normalize slashes
let spath = spath.replace("\\", "/");

const LLVM_PROJECTS: &[&str] = &[
static LLVM_PROJECTS: &[&str] = &[
"llvm-project/clang",
"llvm-project\\clang",
"llvm-project/libunwind",
"llvm-project\\libunwind",
"llvm-project/lld",
"llvm-project\\lld",
"llvm-project/lldb",
"llvm-project\\lldb",
"llvm-project/llvm",
"llvm-project\\llvm",
"llvm-project/compiler-rt",
"llvm-project\\compiler-rt",
"llvm-project/cmake",
"llvm-project\\cmake",
"llvm-project/runtimes",
"llvm-project\\runtimes",
"llvm-project/third-party",
"llvm-project\\third-party",
];
if spath.contains("llvm-project")
&& !spath.ends_with("llvm-project")
&& !LLVM_PROJECTS.iter().any(|path| spath.contains(path))
{
return false;
}
if spath.starts_with("llvm-project") && spath != "llvm-project" {
if !LLVM_PROJECTS.iter().any(|path| spath.starts_with(path)) {
return false;
}

// Keep only these third party libraries
const LLVM_THIRD_PARTY: &[&str] =
&["llvm-project/third-party/siphash", "llvm-project\\third-party\\siphash"];
if (spath.starts_with("llvm-project/third-party")
|| spath.starts_with("llvm-project\\third-party"))
&& !(spath.ends_with("llvm-project/third-party")
|| spath.ends_with("llvm-project\\third-party"))
&& !LLVM_THIRD_PARTY.iter().any(|path| spath.contains(path))
{
return false;
}
// Keep siphash third-party dependency
if spath.starts_with("llvm-project/third-party")
&& spath != "llvm-project/third-party"
&& !spath.starts_with("llvm-project/third-party/siphash")
{
return false;
}

const LLVM_TEST: &[&str] = &["llvm-project/llvm/test", "llvm-project\\llvm\\test"];
if LLVM_TEST.iter().any(|path| spath.contains(path))
&& (spath.ends_with(".ll") || spath.ends_with(".td") || spath.ends_with(".s"))
{
return false;
if spath.starts_with("llvm-project/llvm/test")
&& (spath.ends_with(".ll") || spath.ends_with(".td") || spath.ends_with(".s"))
{
return false;
}
}

// Cargo tests use some files like `.gitignore` that we would otherwise exclude.
const CARGO_TESTS: &[&str] = &["tools/cargo/tests", "tools\\cargo\\tests"];
if CARGO_TESTS.iter().any(|path| spath.contains(path)) {
if spath.starts_with("tools/cargo/tests") {
return true;
}

let full_path = Path::new(dir).join(path);
if exclude_dirs.iter().any(|excl| full_path == Path::new(excl)) {
return false;
if !exclude_dirs.is_empty() {
let full_path = Path::new(dir).join(path);
if exclude_dirs.iter().any(|excl| full_path == Path::new(excl)) {
return false;
}
}

let excludes = [
static EXCLUDES: &[&str] = &[
"CVS",
"RCS",
"SCCS",
Expand All @@ -1011,7 +1006,15 @@ fn copy_src_dirs(
".hgrags",
"_darcs",
];
!path.iter().map(|s| s.to_str().unwrap()).any(|s| excludes.contains(&s))

// We want to check if any component of `path` doesn't contain the strings in `EXCLUDES`.
// However, since we traverse directories top-down in `Builder::cp_link_filtered`,
// it is enough to always check only the last component:
// - If the path is a file, we will iterate to it and then check it's filename
// - If the path is a dir, if it's dir name contains an excluded string, we will not even
// recurse into it.
let last_component = path.iter().next_back().map(|s| s.to_str().unwrap()).unwrap();
!EXCLUDES.contains(&last_component)
}

// Copy the directories using our filter
Expand Down
1 change: 0 additions & 1 deletion src/bootstrap/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1862,7 +1862,6 @@ impl Build {
self.create_dir(&dst);
self.cp_link_filtered_recurse(&path, &dst, &relative, filter);
} else {
let _ = fs::remove_file(&dst);
self.copy_link(&path, &dst, FileType::Regular);
}
}
Expand Down