From 953515131b32deaf26410cb78b7eb6fe93d4d9b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Ber=C3=A1nek?= Date: Thu, 20 Feb 2025 20:43:57 +0100 Subject: [PATCH 1/2] Improve error message when a submodule directory is missing completely --- src/bootstrap/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bootstrap/src/lib.rs b/src/bootstrap/src/lib.rs index dfaf0418d9a2b..c41be41219e0f 100644 --- a/src/bootstrap/src/lib.rs +++ b/src/bootstrap/src/lib.rs @@ -488,7 +488,7 @@ impl Build { } self.config.update_submodule(submodule); let absolute_path = self.config.src.join(submodule); - if dir_is_empty(&absolute_path) { + if !absolute_path.exists() || dir_is_empty(&absolute_path) { let maybe_enable = if !self.config.submodules() && self.config.rust_info.is_managed_git_subrepository() { From c0bea5d92d69c93ec8b6d4374df6863ff312e20f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Ber=C3=A1nek?= Date: Thu, 20 Feb 2025 21:06:25 +0100 Subject: [PATCH 2/2] Add a notice about missing GCC sources in source tarballs --- src/bootstrap/src/core/build_steps/dist.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/bootstrap/src/core/build_steps/dist.rs b/src/bootstrap/src/core/build_steps/dist.rs index 85b224771bb31..795f9506a259b 100644 --- a/src/bootstrap/src/core/build_steps/dist.rs +++ b/src/bootstrap/src/core/build_steps/dist.rs @@ -1029,6 +1029,17 @@ impl Step for PlainSourceTarball { ], plain_dst_src, ); + // We keep something in src/gcc because it is a registered submodule, + // and if it misses completely it can cause issues elsewhere + // (see https://github.com/rust-lang/rust/issues/137332). + // We can also let others know why is the source code missing. + if !builder.config.dry_run() { + builder.create_dir(&plain_dst_src.join("src/gcc")); + t!(std::fs::write( + plain_dst_src.join("src/gcc/notice.txt"), + "The GCC source code is not included due to unclear licensing implications\n" + )); + } // Copy the files normally for item in &src_files {