about summary refs log tree commit diff
path: root/library/std/src
diff options
context:
space:
mode:
authorYuki Okushi <huyuumi.dev@gmail.com>2020-10-02 08:25:19 +0900
committerGitHub <noreply@github.com>2020-10-02 08:25:19 +0900
commit55d0959328d2212c0b16906200bdde3dc8ec2cc5 (patch)
tree6dd376b81de94f56119e7a36115dc9117200f5fb /library/std/src
parentbf15fcd927d8d2e2d4ec6c54c58e5a24a1d43049 (diff)
parent494d6e514bb29341270720067d9842e8862704f8 (diff)
downloadrust-55d0959328d2212c0b16906200bdde3dc8ec2cc5.tar.gz
rust-55d0959328d2212c0b16906200bdde3dc8ec2cc5.zip
Rollup merge of #77362 - RReverser:patch-1, r=dtolnay
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 any paths, including `/some/path`, was returning `false`on a WASI target, which is obviously not true and undesirable.
Diffstat (limited to 'library/std/src')
-rw-r--r--library/std/src/path.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/library/std/src/path.rs b/library/std/src/path.rs
index b83c1e9628d..6fa73042a30 100644
--- a/library/std/src/path.rs
+++ b/library/std/src/path.rs
@@ -1838,7 +1838,7 @@ impl Path {
             // FIXME: Allow Redox prefixes
             self.has_root() || has_redox_scheme(self.as_u8_slice())
         } else {
-            self.has_root() && (cfg!(unix) || self.prefix().is_some())
+            self.has_root() && (cfg!(any(unix, target_os = "wasi")) || self.prefix().is_some())
         }
     }