Skip to content

Commit dde9977

Browse files
authored
Rollup merge of #77746 - winnayx:issue-77572-fix, r=jyn514
Fix `x.py setup` sets `changelog-seen` Fixes #77572 by setting changelog-seen in setup.rs
2 parents ad6e179 + d7494af commit dde9977

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

src/bootstrap/bin/main.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,15 @@
77
88
use std::env;
99

10-
use bootstrap::{Build, Config, Subcommand};
10+
use bootstrap::{Build, Config, Subcommand, VERSION};
1111

1212
fn main() {
1313
let args = env::args().skip(1).collect::<Vec<_>>();
1414
let config = Config::parse(&args);
1515

16-
let changelog_suggestion = check_version(&config);
16+
// check_version warnings are not printed during setup
17+
let changelog_suggestion =
18+
if matches!(config.cmd, Subcommand::Setup {..}) { None } else { check_version(&config) };
1719

1820
// NOTE: Since `./configure` generates a `config.toml`, distro maintainers will see the
1921
// changelog warning, not the `x.py setup` message.
@@ -40,8 +42,6 @@ fn main() {
4042
}
4143

4244
fn check_version(config: &Config) -> Option<String> {
43-
const VERSION: usize = 2;
44-
4545
let mut msg = String::new();
4646

4747
let suggestion = if let Some(seen) = config.changelog_seen {

src/bootstrap/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,8 @@ const LLVM_TOOLS: &[&str] = &[
179179
"llvm-ar", // used for creating and modifying archive files
180180
];
181181

182+
pub const VERSION: usize = 2;
183+
182184
/// A structure representing a Rust compiler.
183185
///
184186
/// Each compiler has a `stage` that it is associated with and a `host` that

src/bootstrap/setup.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::t;
1+
use crate::{t, VERSION};
22
use std::path::{Path, PathBuf};
33
use std::str::FromStr;
44
use std::{
@@ -69,8 +69,9 @@ pub fn setup(src_path: &Path, profile: Profile) {
6969
let path = cfg_file.unwrap_or_else(|| src_path.join("config.toml"));
7070
let settings = format!(
7171
"# Includes one of the default files in src/bootstrap/defaults\n\
72-
profile = \"{}\"\n",
73-
profile
72+
profile = \"{}\"\n\
73+
changelog-seen = {}\n",
74+
profile, VERSION
7475
);
7576
t!(fs::write(path, settings));
7677

0 commit comments

Comments
 (0)