]> git.lizzy.rs Git - rust.git/blobdiff - src/toolchain.rs
Rustup to rustc 1.66.0-nightly (6e95b6da8 2022-10-22)
[rust.git] / src / toolchain.rs
index f86236ef3eafc6eee6c6a476bb19d2fed1f13ce4..b6b465e1f4e0a808a394c07b68ee0563d1538314 100644 (file)
@@ -8,10 +8,8 @@
 /// Tries to infer the path of a binary for the target toolchain from the linker name.
 pub(crate) fn get_toolchain_binary(sess: &Session, tool: &str) -> PathBuf {
     let (mut linker, _linker_flavor) = linker_and_flavor(sess);
-    let linker_file_name = linker
-        .file_name()
-        .and_then(|name| name.to_str())
-        .unwrap_or_else(|| sess.fatal("couldn't extract file name from specified linker"));
+    let linker_file_name =
+        linker.file_name().unwrap().to_str().expect("linker filename should be valid UTF-8");
 
     if linker_file_name == "ld.lld" {
         if tool != "ld" {