about summary refs log tree commit diff
path: root/library/std/src/sys
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2021-02-05 12:11:05 +0000
committerbors <bors@rust-lang.org>2021-02-05 12:11:05 +0000
commitf9435f4c92651d67d5dbaba13c5606c4c4fc1327 (patch)
treed6b3c5182c722eef20e17d3a76f84ce13977bf27 /library/std/src/sys
parent730d6dfdddc0f55d9cbeedb29a14b342f74e2a9d (diff)
parent2383cd4b2d820f968a57f9750bf4b4471a655835 (diff)
downloadrust-f9435f4c92651d67d5dbaba13c5606c4c4fc1327.tar.gz
rust-f9435f4c92651d67d5dbaba13c5606c4c4fc1327.zip
Auto merge of #81784 - m-ou-se:rollup-s23fow7, r=m-ou-se
Rollup of 15 pull requests

Successful merges:

 - #79554 (Generic associated types in trait paths)
 - #80726 (relax adt unsizing requirements)
 - #81307 (Handle `Span`s for byte and raw strings and add more detail )
 - #81318 (rustdoc-json: Fix has_body)
 - #81456 (Make remote-test-server easier to use with new targets)
 - #81497 (rustdoc: Move `display_fn` struct inside `display_fn`)
 - #81500 (Remove struct_type from union output)
 - #81542 (Expose correct symlink API on WASI)
 - #81676 (Add more information to the error code for 'crate not found')
 - #81682 (Add additional bitset benchmarks)
 - #81730 (Make `Allocator` object-safe)
 - #81763 (Cleanup rustdoc pass descriptions a bit)
 - #81767 (Update LayoutError/LayoutErr stability attributes)
 - #81771 (Indicate change in RSS from start to end of pass in time-passes output)
 - #81781 (Fix `install-awscli.sh` error in CI)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'library/std/src/sys')
-rw-r--r--library/std/src/sys/wasi/ext/fs.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/library/std/src/sys/wasi/ext/fs.rs b/library/std/src/sys/wasi/ext/fs.rs
index 4f7cf6018d9..a8da003d550 100644
--- a/library/std/src/sys/wasi/ext/fs.rs
+++ b/library/std/src/sys/wasi/ext/fs.rs
@@ -514,3 +514,11 @@ pub fn symlink<P: AsRef<Path>, U: AsRef<Path>>(
         .fd()
         .symlink(osstr2str(old_path.as_ref().as_ref())?, osstr2str(new_path.as_ref().as_ref())?)
 }
+
+/// Create a symbolic link.
+///
+/// This is a convenience API similar to [`std::os::unix::fs::symlink`] and
+/// [`std::os::windows::fs::symlink_file`] and [`symlink_dir`](std::os::windows::fs::symlink_dir).
+pub fn symlink_path<P: AsRef<Path>, U: AsRef<Path>>(old_path: P, new_path: U) -> io::Result<()> {
+    crate::sys::fs::symlink(old_path.as_ref(), new_path.as_ref())
+}