Skip to content

Commit 2155c03

Browse files
committed
Inline Compiler::bootstrap_with_triple
1 parent de8a4d5 commit 2155c03

File tree

2 files changed

+17
-18
lines changed

2 files changed

+17
-18
lines changed

build_system/mod.rs

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use std::env;
2-
use std::path::{Path, PathBuf};
2+
use std::path::PathBuf;
33
use std::process;
44

55
use self::utils::{is_ci, is_ci_opt, Compiler};
@@ -101,12 +101,24 @@ pub(crate) fn main() {
101101
}
102102
}
103103

104-
let bootstrap_host_compiler = Compiler::bootstrap_with_triple(
105-
std::env::var("HOST_TRIPLE")
104+
let bootstrap_host_compiler = {
105+
let cargo = rustc_info::get_cargo_path();
106+
let rustc = rustc_info::get_rustc_path();
107+
let rustdoc = rustc_info::get_rustdoc_path();
108+
let triple = std::env::var("HOST_TRIPLE")
106109
.ok()
107110
.or_else(|| config::get_value("host"))
108-
.unwrap_or_else(|| rustc_info::get_host_triple(Path::new("rustc"))),
109-
);
111+
.unwrap_or_else(|| rustc_info::get_host_triple(&rustc));
112+
Compiler {
113+
cargo,
114+
rustc,
115+
rustdoc,
116+
rustflags: String::new(),
117+
rustdocflags: String::new(),
118+
triple,
119+
runner: vec![],
120+
}
121+
};
110122
let target_triple = std::env::var("TARGET_TRIPLE")
111123
.ok()
112124
.or_else(|| config::get_value("target"))

build_system/utils.rs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ use std::path::{Path, PathBuf};
55
use std::process::{self, Command, Stdio};
66

77
use super::path::{Dirs, RelPath};
8-
use super::rustc_info::{get_cargo_path, get_rustc_path, get_rustdoc_path};
98

109
#[derive(Clone, Debug)]
1110
pub(crate) struct Compiler {
@@ -19,18 +18,6 @@ pub(crate) struct Compiler {
1918
}
2019

2120
impl Compiler {
22-
pub(crate) fn bootstrap_with_triple(triple: String) -> Compiler {
23-
Compiler {
24-
cargo: get_cargo_path(),
25-
rustc: get_rustc_path(),
26-
rustdoc: get_rustdoc_path(),
27-
rustflags: String::new(),
28-
rustdocflags: String::new(),
29-
triple,
30-
runner: vec![],
31-
}
32-
}
33-
3421
pub(crate) fn set_cross_linker_and_runner(&mut self) {
3522
match self.triple.as_str() {
3623
"aarch64-unknown-linux-gnu" => {

0 commit comments

Comments
 (0)