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).
This commit is contained in:
Tim Hutt
2025-03-22 22:24:08 +00:00
parent e2014e876e
commit bdd680ffd1

View File

@@ -168,6 +168,11 @@ fn current_dll_path() -> Result<PathBuf, String> {
Ok(OsString::from_wide(&filename).into()) Ok(OsString::from_wide(&filename).into())
} }
#[cfg(target_os = "wasi")]
fn current_dll_path() -> Result<PathBuf, String> {
Err("current_dll_path is not supported on WASI".to_string())
}
pub fn sysroot_candidates() -> SmallVec<[PathBuf; 2]> { pub fn sysroot_candidates() -> SmallVec<[PathBuf; 2]> {
let target = crate::config::host_tuple(); let target = crate::config::host_tuple();
let mut sysroot_candidates: SmallVec<[PathBuf; 2]> = smallvec![get_or_default_sysroot()]; let mut sysroot_candidates: SmallVec<[PathBuf; 2]> = smallvec![get_or_default_sysroot()];