about summary refs log tree commit diff
diff options
context:
space:
mode:
authorChris Denton <christophersdenton@gmail.com>2025-04-13 11:48:20 +0000
committerGitHub <noreply@github.com>2025-04-13 11:48:20 +0000
commit54aff1f6ef5260778dffee93489ec39d3352a2c8 (patch)
treecf24976c252fc5a47e07bc73a0feeaef713cb7b9
parentdaed9e2d9f80bb3b831a53c69a4368f068a6d53b (diff)
parent6ba9649e7c80b999b956adbdad3e9ecbbb1e24f3 (diff)
downloadrust-54aff1f6ef5260778dffee93489ec39d3352a2c8.tar.gz
rust-54aff1f6ef5260778dffee93489ec39d3352a2c8.zip
Rollup merge of #139721 - dtolnay:stage0newline, r=onur-ozkan
End all lines in src/stage0 with trailing newline

Most tools that process text files prefer if every line ends in \n. Text files without the last newline are aberrant and usually not what you want.

**Before:**

```console
$ cat src/stage0 src/stage0
dist_server=https://static.rust-lang.org
artifacts_server=https://ci-artifacts.rust-lang.org/rustc-builds
...
dist/2025-04-02/rustc-nightly-x86_64-unknown-netbsd.tar.gz=986f6c594d37bcbd3833e053640ba8775f68d26a65c5618386654ef55d7b3542
dist/2025-04-02/rustc-nightly-x86_64-unknown-netbsd.tar.xz=c0d9a88c30d2ab38ec3a11fabb5515ed9bc3ac1a8e35a438d68bf7ff82f6b843dist_server=https://static.rust-lang.org
artifacts_server=https://ci-artifacts.rust-lang.org/rustc-builds
...
dist/2025-04-02/rustc-nightly-x86_64-unknown-netbsd.tar.gz=986f6c594d37bcbd3833e053640ba8775f68d26a65c5618386654ef55d7b3542
dist/2025-04-02/rustc-nightly-x86_64-unknown-netbsd.tar.xz=c0d9a88c30d2ab38ec3a11fabb5515ed9bc3ac1a8e35a438d68bf7ff82f6b843$ ▌
```

**After:**

```console
$ cat src/stage0 src/stage0
dist_server=https://static.rust-lang.org
artifacts_server=https://ci-artifacts.rust-lang.org/rustc-builds
...
dist/2025-04-02/rustc-nightly-x86_64-unknown-netbsd.tar.gz=986f6c594d37bcbd3833e053640ba8775f68d26a65c5618386654ef55d7b3542
dist/2025-04-02/rustc-nightly-x86_64-unknown-netbsd.tar.xz=c0d9a88c30d2ab38ec3a11fabb5515ed9bc3ac1a8e35a438d68bf7ff82f6b843
dist_server=https://static.rust-lang.org
artifacts_server=https://ci-artifacts.rust-lang.org/rustc-builds
...
dist/2025-04-02/rustc-nightly-x86_64-unknown-netbsd.tar.gz=986f6c594d37bcbd3833e053640ba8775f68d26a65c5618386654ef55d7b3542
dist/2025-04-02/rustc-nightly-x86_64-unknown-netbsd.tar.xz=c0d9a88c30d2ab38ec3a11fabb5515ed9bc3ac1a8e35a438d68bf7ff82f6b843
$ ▌
```
-rw-r--r--src/stage02
-rw-r--r--src/tools/bump-stage0/src/main.rs25
2 files changed, 14 insertions, 13 deletions
diff --git a/src/stage0 b/src/stage0
index b3841d253f3..6e86501a72a 100644
--- a/src/stage0
+++ b/src/stage0
@@ -476,4 +476,4 @@ dist/2025-04-02/rustc-nightly-x86_64-unknown-linux-gnu.tar.xz=e67a33440c3e021ff2
 dist/2025-04-02/rustc-nightly-x86_64-unknown-linux-musl.tar.gz=0ea7e17d7bb67d6a6c4b2f864aaffcd96512f15f17f0acc63751eb1df6c486a7
 dist/2025-04-02/rustc-nightly-x86_64-unknown-linux-musl.tar.xz=b73d37b704ab58921172cc561f5598db6a504dcd4d7980966f7c26caaf6d3594
 dist/2025-04-02/rustc-nightly-x86_64-unknown-netbsd.tar.gz=986f6c594d37bcbd3833e053640ba8775f68d26a65c5618386654ef55d7b3542
-dist/2025-04-02/rustc-nightly-x86_64-unknown-netbsd.tar.xz=c0d9a88c30d2ab38ec3a11fabb5515ed9bc3ac1a8e35a438d68bf7ff82f6b843
\ No newline at end of file
+dist/2025-04-02/rustc-nightly-x86_64-unknown-netbsd.tar.xz=c0d9a88c30d2ab38ec3a11fabb5515ed9bc3ac1a8e35a438d68bf7ff82f6b843
diff --git a/src/tools/bump-stage0/src/main.rs b/src/tools/bump-stage0/src/main.rs
index f51072718a3..d679084ae44 100644
--- a/src/tools/bump-stage0/src/main.rs
+++ b/src/tools/bump-stage0/src/main.rs
@@ -65,32 +65,33 @@ impl Tool {
             nightly_branch,
         } = &self.config;
 
-        file_content.push_str(&format!("dist_server={}", dist_server));
-        file_content.push_str(&format!("\nartifacts_server={}", artifacts_server));
+        file_content.push_str(&format!("dist_server={}\n", dist_server));
+        file_content.push_str(&format!("artifacts_server={}\n", artifacts_server));
         file_content.push_str(&format!(
-            "\nartifacts_with_llvm_assertions_server={}",
+            "artifacts_with_llvm_assertions_server={}\n",
             artifacts_with_llvm_assertions_server
         ));
-        file_content.push_str(&format!("\ngit_merge_commit_email={}", git_merge_commit_email));
-        file_content.push_str(&format!("\ngit_repository={}", git_repository));
-        file_content.push_str(&format!("\nnightly_branch={}", nightly_branch));
+        file_content.push_str(&format!("git_merge_commit_email={}\n", git_merge_commit_email));
+        file_content.push_str(&format!("git_repository={}\n", git_repository));
+        file_content.push_str(&format!("nightly_branch={}\n", nightly_branch));
 
-        file_content.push_str("\n\n");
+        file_content.push_str("\n");
         file_content.push_str(COMMENTS);
+        file_content.push_str("\n");
 
         let compiler = self.detect_compiler()?;
-        file_content.push_str(&format!("\ncompiler_date={}", compiler.date));
-        file_content.push_str(&format!("\ncompiler_version={}", compiler.version));
+        file_content.push_str(&format!("compiler_date={}\n", compiler.date));
+        file_content.push_str(&format!("compiler_version={}\n", compiler.version));
 
         if let Some(rustfmt) = self.detect_rustfmt()? {
-            file_content.push_str(&format!("\nrustfmt_date={}", rustfmt.date));
-            file_content.push_str(&format!("\nrustfmt_version={}", rustfmt.version));
+            file_content.push_str(&format!("rustfmt_date={}\n", rustfmt.date));
+            file_content.push_str(&format!("rustfmt_version={}\n", rustfmt.version));
         }
 
         file_content.push_str("\n");
 
         for (key, value) in self.checksums {
-            file_content.push_str(&format!("\n{}={}", key, value));
+            file_content.push_str(&format!("{}={}\n", key, value));
         }
 
         std::fs::write(PATH, file_content)?;