Skip to content

Commit 494d6e5

Browse files
authored
Fix is_absolute on WASI
WASI does not match `cfg(unix)`, but its paths are Unix-like (`/some/path`) and don't have Windows-like prefixes. Without this change, `is_absolute` for paths like `/some/path` was returning `false`on a WASI target, which is obviously not true and undesirable.
1 parent 12f667f commit 494d6e5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

library/std/src/path.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1838,7 +1838,7 @@ impl Path {
18381838
// FIXME: Allow Redox prefixes
18391839
self.has_root() || has_redox_scheme(self.as_u8_slice())
18401840
} else {
1841-
self.has_root() && (cfg!(unix) || self.prefix().is_some())
1841+
self.has_root() && (cfg!(any(unix, target_os = "wasi")) || self.prefix().is_some())
18421842
}
18431843
}
18441844

0 commit comments

Comments
 (0)