about summary refs log tree commit diff
path: root/src/bootstrap
diff options
context:
space:
mode:
authorYuki Okushi <huyuumi.dev@gmail.com>2020-10-13 04:07:56 +0900
committerGitHub <noreply@github.com>2020-10-13 04:07:56 +0900
commitdde997710ab95c9e3d13c30d86907829aa5ee0e4 (patch)
tree36e1cc3d4418acc9e2721638b91745926c935018 /src/bootstrap
parentad6e179060c812fe7d581e7b1a6ce0c0e535d72c (diff)
parentd7494af5513de786591f5fb85a763d05134466de (diff)
downloadrust-dde997710ab95c9e3d13c30d86907829aa5ee0e4.tar.gz
rust-dde997710ab95c9e3d13c30d86907829aa5ee0e4.zip
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
Diffstat (limited to 'src/bootstrap')
-rw-r--r--src/bootstrap/bin/main.rs8
-rw-r--r--src/bootstrap/lib.rs2
-rw-r--r--src/bootstrap/setup.rs7
3 files changed, 10 insertions, 7 deletions
diff --git a/src/bootstrap/bin/main.rs b/src/bootstrap/bin/main.rs
index d31f95ee5e9..07e582d4d29 100644
--- a/src/bootstrap/bin/main.rs
+++ b/src/bootstrap/bin/main.rs
@@ -7,13 +7,15 @@
 
 use std::env;
 
-use bootstrap::{Build, Config, Subcommand};
+use bootstrap::{Build, Config, Subcommand, VERSION};
 
 fn main() {
     let args = env::args().skip(1).collect::<Vec<_>>();
     let config = Config::parse(&args);
 
-    let changelog_suggestion = check_version(&config);
+    // check_version warnings are not printed during setup
+    let changelog_suggestion =
+        if matches!(config.cmd, Subcommand::Setup {..}) { None } else { check_version(&config) };
 
     // NOTE: Since `./configure` generates a `config.toml`, distro maintainers will see the
     // changelog warning, not the `x.py setup` message.
@@ -40,8 +42,6 @@ fn main() {
 }
 
 fn check_version(config: &Config) -> Option<String> {
-    const VERSION: usize = 2;
-
     let mut msg = String::new();
 
     let suggestion = if let Some(seen) = config.changelog_seen {
diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs
index bf81c4bf28e..493bfff9181 100644
--- a/src/bootstrap/lib.rs
+++ b/src/bootstrap/lib.rs
@@ -179,6 +179,8 @@ const LLVM_TOOLS: &[&str] = &[
     "llvm-ar", // used for creating and modifying archive files
 ];
 
+pub const VERSION: usize = 2;
+
 /// A structure representing a Rust compiler.
 ///
 /// Each compiler has a `stage` that it is associated with and a `host` that
diff --git a/src/bootstrap/setup.rs b/src/bootstrap/setup.rs
index dcfb9fd6734..512224156d8 100644
--- a/src/bootstrap/setup.rs
+++ b/src/bootstrap/setup.rs
@@ -1,4 +1,4 @@
-use crate::t;
+use crate::{t, VERSION};
 use std::path::{Path, PathBuf};
 use std::str::FromStr;
 use std::{
@@ -69,8 +69,9 @@ pub fn setup(src_path: &Path, profile: Profile) {
     let path = cfg_file.unwrap_or_else(|| src_path.join("config.toml"));
     let settings = format!(
         "# Includes one of the default files in src/bootstrap/defaults\n\
-    profile = \"{}\"\n",
-        profile
+    profile = \"{}\"\n\
+    changelog-seen = {}\n",
+        profile, VERSION
     );
     t!(fs::write(path, settings));