Skip to content

Commit 8c5375a

Browse files
committed
move comments position in src/stage0
Signed-off-by: onur-ozkan <[email protected]>
1 parent aa2faef commit 8c5375a

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed

src/stage0

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
dist_server=https://static.rust-lang.org
2+
artifacts_server=https://ci-artifacts.rust-lang.org/rustc-builds
3+
artifacts_with_llvm_assertions_server=https://ci-artifacts.rust-lang.org/rustc-builds-alt
4+
5+
git_repository=rust-lang/rust
6+
nightly_branch=master
7+
18
# The configuration above this comment is editable, and can be changed
29
# by forks of the repository if they have alternate values.
310
#
@@ -6,14 +13,7 @@
613
#
714
# All changes below this comment will be overridden the next time the
815
# tool is executed.
9-
10-
dist_server=https://static.rust-lang.org
11-
artifacts_server=https://ci-artifacts.rust-lang.org/rustc-builds
12-
artifacts_with_llvm_assertions_server=https://ci-artifacts.rust-lang.org/rustc-builds-alt
13-
14-
git_repository=rust-lang/rust
15-
nightly_branch=master
16-
16+
1717
compiler_date=2024-04-29
1818
compiler_version=beta
1919
rustfmt_date=2024-04-29

src/tools/bump-stage0/src/main.rs

+7-4
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ impl Tool {
4343
}
4444

4545
fn update_stage0_file(mut self) -> Result<(), Error> {
46-
const HEADER: &str = r#"# The configuration above this comment is editable, and can be changed
46+
const COMMENTS: &str = r#"# The configuration above this comment is editable, and can be changed
4747
# by forks of the repository if they have alternate values.
4848
#
4949
# The section below is generated by `./x.py run src/tools/bump-stage0`,
@@ -53,8 +53,10 @@ impl Tool {
5353
# tool is executed.
5454
"#;
5555

56-
let mut file_content = HEADER.to_owned();
56+
let mut file_content = String::new();
5757

58+
// Destructure `Stage0Config` here to ensure the stage0 file is synced with any new
59+
// fields when they are added.
5860
let Stage0Config {
5961
dist_server,
6062
artifacts_server,
@@ -64,7 +66,7 @@ impl Tool {
6466
nightly_branch,
6567
} = &self.config;
6668

67-
file_content.push_str(&format!("\ndist_server={}", dist_server));
69+
file_content.push_str(&format!("dist_server={}", dist_server));
6870
file_content.push_str(&format!("\nartifacts_server={}", artifacts_server));
6971
file_content.push_str(&format!(
7072
"\nartifacts_with_llvm_assertions_server={}",
@@ -74,7 +76,8 @@ impl Tool {
7476
file_content.push_str(&format!("\ngit_repository={}", git_repository));
7577
file_content.push_str(&format!("\nnightly_branch={}", nightly_branch));
7678

77-
file_content.push_str("\n");
79+
file_content.push_str("\n\n");
80+
file_content.push_str(COMMENTS);
7881

7982
let compiler = self.detect_compiler()?;
8083
file_content.push_str(&format!("\ncompiler_date={}", compiler.date));

0 commit comments

Comments
 (0)