From bdd680ffd15e5e9672d0a82e363d8193e575a132 Mon Sep 17 00:00:00 2001 From: Tim Hutt Date: Sat, 22 Mar 2025 22:24:08 +0000 Subject: [PATCH] Add unimplemented `current_dll_path()` for WASI This is the only change needed to Rust to allow compiling rustfmt for WASI (rustfmt uses some internal rustc crates). --- compiler/rustc_session/src/filesearch.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/compiler/rustc_session/src/filesearch.rs b/compiler/rustc_session/src/filesearch.rs index bdeca91eb64a4..cd994f2fccb28 100644 --- a/compiler/rustc_session/src/filesearch.rs +++ b/compiler/rustc_session/src/filesearch.rs @@ -168,6 +168,11 @@ fn current_dll_path() -> Result { Ok(OsString::from_wide(&filename).into()) } +#[cfg(target_os = "wasi")] +fn current_dll_path() -> Result { + Err("current_dll_path is not supported on WASI".to_string()) +} + pub fn sysroot_candidates() -> SmallVec<[PathBuf; 2]> { let target = crate::config::host_tuple(); let mut sysroot_candidates: SmallVec<[PathBuf; 2]> = smallvec![get_or_default_sysroot()];