about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/stage016
-rw-r--r--src/tools/bump-stage0/src/main.rs11
2 files changed, 15 insertions, 12 deletions
diff --git a/src/stage0 b/src/stage0
index ed06372741e..5ec8f5b715e 100644
--- a/src/stage0
+++ b/src/stage0
@@ -1,3 +1,10 @@
+dist_server=https://static.rust-lang.org
+artifacts_server=https://ci-artifacts.rust-lang.org/rustc-builds
+artifacts_with_llvm_assertions_server=https://ci-artifacts.rust-lang.org/rustc-builds-alt
+git_merge_commit_email=bors@rust-lang.org
+git_repository=rust-lang/rust
+nightly_branch=master
+
 # The configuration above this comment is editable, and can be changed
 # by forks of the repository if they have alternate values.
 #
@@ -6,14 +13,7 @@
 #
 # All changes below this comment will be overridden the next time the
 # tool is executed.
-
-dist_server=https://static.rust-lang.org
-artifacts_server=https://ci-artifacts.rust-lang.org/rustc-builds
-artifacts_with_llvm_assertions_server=https://ci-artifacts.rust-lang.org/rustc-builds-alt
-git_merge_commit_email=bors@rust-lang.org
-git_repository=rust-lang/rust
-nightly_branch=master
-
+            
 compiler_date=2024-04-29
 compiler_version=beta
 rustfmt_date=2024-04-29
diff --git a/src/tools/bump-stage0/src/main.rs b/src/tools/bump-stage0/src/main.rs
index f9c1699eb4c..bb06e113c0e 100644
--- a/src/tools/bump-stage0/src/main.rs
+++ b/src/tools/bump-stage0/src/main.rs
@@ -43,7 +43,7 @@ impl Tool {
     }
 
     fn update_stage0_file(mut self) -> Result<(), Error> {
-        const HEADER: &str = r#"# The configuration above this comment is editable, and can be changed
+        const COMMENTS: &str = r#"# The configuration above this comment is editable, and can be changed
 # by forks of the repository if they have alternate values.
 #
 # The section below is generated by `./x.py run src/tools/bump-stage0`,
@@ -53,8 +53,10 @@ impl Tool {
 # tool is executed.
             "#;
 
-        let mut file_content = HEADER.to_owned();
+        let mut file_content = String::new();
 
+        // Destructure `Stage0Config` here to ensure the stage0 file is synced with any new
+        // fields when they are added.
         let Stage0Config {
             dist_server,
             artifacts_server,
@@ -64,7 +66,7 @@ impl Tool {
             nightly_branch,
         } = &self.config;
 
-        file_content.push_str(&format!("\ndist_server={}", dist_server));
+        file_content.push_str(&format!("dist_server={}", dist_server));
         file_content.push_str(&format!("\nartifacts_server={}", artifacts_server));
         file_content.push_str(&format!(
             "\nartifacts_with_llvm_assertions_server={}",
@@ -74,7 +76,8 @@ impl Tool {
         file_content.push_str(&format!("\ngit_repository={}", git_repository));
         file_content.push_str(&format!("\nnightly_branch={}", nightly_branch));
 
-        file_content.push_str("\n");
+        file_content.push_str("\n\n");
+        file_content.push_str(COMMENTS);
 
         let compiler = self.detect_compiler()?;
         file_content.push_str(&format!("\ncompiler_date={}", compiler.date));