Skip to content

Commit

Permalink
Rollup merge of #77362 - RReverser:patch-1, r=dtolnay
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
JohnTitor authored Oct 1, 2020
2 parents bf15fcd + 494d6e5 commit 55d0959
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion library/std/src/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}
}

Expand Down

0 comments on commit 55d0959

Please sign in to comment.