Skip to content

Commit e823093

Browse files
committed
use rustc_version also to parse host in compiletest
1 parent 05f2b2e commit e823093

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

tests/compiletest.rs

+5-7
Original file line numberDiff line numberDiff line change
@@ -142,17 +142,15 @@ fn get_sysroot() -> PathBuf {
142142

143143
fn get_host() -> String {
144144
let rustc = rustc_test_suite().unwrap_or(PathBuf::from("rustc"));
145-
let host = std::process::Command::new(rustc)
145+
let rustc_version = std::process::Command::new(rustc)
146146
.arg("-vV")
147147
.output()
148148
.expect("rustc not found for -vV")
149149
.stdout;
150-
let host = std::str::from_utf8(&host).expect("sysroot is not utf8");
151-
let host = host.split("\nhost: ").nth(1).expect(
152-
"no host: part in rustc -vV",
153-
);
154-
let host = host.split('\n').next().expect("no \n after host");
155-
String::from(host)
150+
let rustc_version = std::str::from_utf8(&rustc_version).expect("host is not utf8");
151+
let version_meta = rustc_version::version_meta_for(&rustc_version)
152+
.expect("failed to parse rustc version info");
153+
version_meta.host
156154
}
157155

158156
fn run_pass_miri(opt: bool) {

0 commit comments

Comments
 (0)