about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbjorn3 <17426603+bjorn3@users.noreply.github.com>2023-02-10 10:03:42 +0000
committerbjorn3 <17426603+bjorn3@users.noreply.github.com>2023-05-22 17:10:55 +0000
commit2155c0350081ae159e37aa25cfd829da950bb282 (patch)
tree93c4bf33d01d3acdd2272e0442072806a7e19629
parentde8a4d5d46f6f270ea35192a03d701230d0552e8 (diff)
downloadrust-2155c0350081ae159e37aa25cfd829da950bb282.tar.gz
rust-2155c0350081ae159e37aa25cfd829da950bb282.zip
Inline Compiler::bootstrap_with_triple
-rw-r--r--build_system/mod.rs22
-rw-r--r--build_system/utils.rs13
2 files changed, 17 insertions, 18 deletions
diff --git a/build_system/mod.rs b/build_system/mod.rs
index 0a83ea93778..80a777fc00e 100644
--- a/build_system/mod.rs
+++ b/build_system/mod.rs
@@ -1,5 +1,5 @@
 use std::env;
-use std::path::{Path, PathBuf};
+use std::path::PathBuf;
 use std::process;
 
 use self::utils::{is_ci, is_ci_opt, Compiler};
@@ -101,12 +101,24 @@ pub(crate) fn main() {
         }
     }
 
-    let bootstrap_host_compiler = Compiler::bootstrap_with_triple(
-        std::env::var("HOST_TRIPLE")
+    let bootstrap_host_compiler = {
+        let cargo = rustc_info::get_cargo_path();
+        let rustc = rustc_info::get_rustc_path();
+        let rustdoc = rustc_info::get_rustdoc_path();
+        let triple = std::env::var("HOST_TRIPLE")
             .ok()
             .or_else(|| config::get_value("host"))
-            .unwrap_or_else(|| rustc_info::get_host_triple(Path::new("rustc"))),
-    );
+            .unwrap_or_else(|| rustc_info::get_host_triple(&rustc));
+        Compiler {
+            cargo,
+            rustc,
+            rustdoc,
+            rustflags: String::new(),
+            rustdocflags: String::new(),
+            triple,
+            runner: vec![],
+        }
+    };
     let target_triple = std::env::var("TARGET_TRIPLE")
         .ok()
         .or_else(|| config::get_value("target"))
diff --git a/build_system/utils.rs b/build_system/utils.rs
index 8928ed7cd56..6c0ecd8b02a 100644
--- a/build_system/utils.rs
+++ b/build_system/utils.rs
@@ -5,7 +5,6 @@ use std::path::{Path, PathBuf};
 use std::process::{self, Command, Stdio};
 
 use super::path::{Dirs, RelPath};
-use super::rustc_info::{get_cargo_path, get_rustc_path, get_rustdoc_path};
 
 #[derive(Clone, Debug)]
 pub(crate) struct Compiler {
@@ -19,18 +18,6 @@ pub(crate) struct Compiler {
 }
 
 impl Compiler {
-    pub(crate) fn bootstrap_with_triple(triple: String) -> Compiler {
-        Compiler {
-            cargo: get_cargo_path(),
-            rustc: get_rustc_path(),
-            rustdoc: get_rustdoc_path(),
-            rustflags: String::new(),
-            rustdocflags: String::new(),
-            triple,
-            runner: vec![],
-        }
-    }
-
     pub(crate) fn set_cross_linker_and_runner(&mut self) {
         match self.triple.as_str() {
             "aarch64-unknown-linux-gnu" => {