about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-01-12 07:40:32 +0000
committerbors <bors@rust-lang.org>2023-01-12 07:40:32 +0000
commit2b8590ef3bd1221830ec8a4131ea9d02b1636746 (patch)
tree7c99d064572f9d620f1e5d51db183bad0b785991 /src
parent4887cb18dc2ef5b1bf3fc50ce6c267fde085032b (diff)
parente8ef83e4c060ec66a8dbb3d729af67ffd34f6a92 (diff)
Auto merge of #106757 - matthiaskrgr:rollup-9j8830g, r=matthiaskrgr
Rollup of 10 pull requests

Successful merges:

 - #106167 (Fix invalid syntax and incomplete suggestion in impl Trait parameter type suggestions for E0311)
 - #106309 (Prefer non-`[type error]` candidates during selection)
 - #106532 (Allow codegen to unsize `dyn*` to `dyn`)
 - #106596 (Hide more of long types in E0271)
 - #106638 (std tests: use __OsLocalKeyInner from realstd)
 - #106676 (Test that we cannot use trait impl methods arguments as defining uses)
 - #106702 (Conserve cause of `ImplDerivedObligation` in E0599)
 - #106732 (rustc_llvm: replace llvm::makeArrayRef with ArrayRef constructors.)
 - #106733 (Revert "warn newer available version of the x tool")
 - #106748 (Clean up `OnUnimplementedFormatString::verify`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'src')
-rw-r--r--src/bootstrap/bootstrap.py3
-rw-r--r--src/tools/tidy/Cargo.toml1
-rw-r--r--src/tools/tidy/src/lib.rs1
-rw-r--r--src/tools/tidy/src/main.rs4
-rw-r--r--src/tools/tidy/src/x_version.rs65
5 files changed, 3 insertions, 71 deletions
diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py
index f3998e98583..9cf43fc7a21 100644
--- a/src/bootstrap/bootstrap.py
+++ b/src/bootstrap/bootstrap.py
@@ -934,7 +934,8 @@ def main():
     if len(sys.argv) > 1 and sys.argv[1] == 'help':
         sys.argv = [sys.argv[0], '-h'] + sys.argv[2:]
 
-    help_triggered = len(sys.argv) == 1 or any(x in ["-h", "--help", "--version"] for x in sys.argv)
+    help_triggered = (
+        '-h' in sys.argv) or ('--help' in sys.argv) or (len(sys.argv) == 1)
     try:
         bootstrap(help_triggered)
         if not help_triggered:
diff --git a/src/tools/tidy/Cargo.toml b/src/tools/tidy/Cargo.toml
index 5f5ae3a65ef..fff83a1d097 100644
--- a/src/tools/tidy/Cargo.toml
+++ b/src/tools/tidy/Cargo.toml
@@ -11,7 +11,6 @@ miropt-test-tools = { path = "../miropt-test-tools" }
 lazy_static = "1"
 walkdir = "2"
 ignore = "0.4.18"
-semver = "1.0.14"
 termcolor = "1.1.3"
 
 [[bin]]
diff --git a/src/tools/tidy/src/lib.rs b/src/tools/tidy/src/lib.rs
index 1eb146989e4..40375f1306d 100644
--- a/src/tools/tidy/src/lib.rs
+++ b/src/tools/tidy/src/lib.rs
@@ -69,4 +69,3 @@ pub mod ui_tests;
 pub mod unit_tests;
 pub mod unstable_book;
 pub mod walk;
-pub mod x_version;
diff --git a/src/tools/tidy/src/main.rs b/src/tools/tidy/src/main.rs
index 79441cda64c..ea2886a3c2f 100644
--- a/src/tools/tidy/src/main.rs
+++ b/src/tools/tidy/src/main.rs
@@ -60,7 +60,7 @@ fn main() {
 
                 let handle = s.spawn(|| {
                     let mut flag = false;
-                    $p::check($($args, )* &mut flag);
+                    $p::check($($args),* , &mut flag);
                     if (flag) {
                         bad.store(true, Ordering::Relaxed);
                     }
@@ -113,8 +113,6 @@ fn main() {
         check!(alphabetical, &compiler_path);
         check!(alphabetical, &library_path);
 
-        check!(x_version, &root_path, &cargo);
-
         let collected = {
             drain_handles(&mut handles);
 
diff --git a/src/tools/tidy/src/x_version.rs b/src/tools/tidy/src/x_version.rs
deleted file mode 100644
index 5dc6a0588c3..00000000000
--- a/src/tools/tidy/src/x_version.rs
+++ /dev/null
@@ -1,65 +0,0 @@
-use semver::Version;
-use std::io::ErrorKind;
-use std::path::Path;
-use std::process::{Command, Stdio};
-
-pub fn check(root: &Path, cargo: &Path, bad: &mut bool) {
-    let result = Command::new("x").arg("--wrapper-version").stdout(Stdio::piped()).spawn();
-    // This runs the command inside a temporary directory.
-    // This allows us to compare output of result to see if `--wrapper-version` is not a recognized argument to x.
-    let temp_result = Command::new("x")
-        .arg("--wrapper-version")
-        .current_dir(std::env::temp_dir())
-        .stdout(Stdio::piped())
-        .spawn();
-
-    let (child, temp_child) = match (result, temp_result) {
-        (Ok(child), Ok(temp_child)) => (child, temp_child),
-        (Err(e), _) | (_, Err(e)) => match e.kind() {
-            ErrorKind::NotFound => return,
-            _ => return tidy_error!(bad, "failed to run `x`: {}", e),
-        },
-    };
-
-    let output = child.wait_with_output().unwrap();
-    let temp_output = temp_child.wait_with_output().unwrap();
-
-    if output != temp_output {
-        return tidy_error!(
-            bad,
-            "Current version of x does not support the `--wrapper-version` argument\nConsider updating to the newer version of x by running `cargo install --path src/tools/x`"
-        );
-    }
-
-    if output.status.success() {
-        let version = String::from_utf8_lossy(&output.stdout);
-        let version = Version::parse(version.trim_end()).unwrap();
-
-        if let Some(expected) = get_x_wrapper_version(root, cargo) {
-            if version < expected {
-                return tidy_error!(
-                    bad,
-                    "Current version of x is {version}, but the latest version is {expected}\nConsider updating to the newer version of x by running `cargo install --path src/tools/x`"
-                );
-            }
-        } else {
-            return tidy_error!(
-                bad,
-                "Unable to parse the latest version of `x` at `src/tools/x/Cargo.toml`"
-            );
-        }
-    } else {
-        return tidy_error!(bad, "failed to check version of `x`: {}", output.status);
-    }
-}
-
-// Parse latest version out of `x` Cargo.toml
-fn get_x_wrapper_version(root: &Path, cargo: &Path) -> Option<Version> {
-    let mut cmd = cargo_metadata::MetadataCommand::new();
-    cmd.cargo_path(cargo)
-        .manifest_path(root.join("src/tools/x/Cargo.toml"))
-        .no_deps()
-        .features(cargo_metadata::CargoOpt::AllFeatures);
-    let mut metadata = t!(cmd.exec());
-    metadata.packages.pop().map(|x| x.version)
-}