]> git.lizzy.rs Git - rust.git/commit - src/tools/rustfmt
Auto merge of #79060 - dtolnay:symlinkarg, r=Mark-Simulacrum
authorbors <bors@rust-lang.org>
Thu, 19 Nov 2020 22:26:32 +0000 (22:26 +0000)
committerbors <bors@rust-lang.org>
Thu, 19 Nov 2020 22:26:32 +0000 (22:26 +0000)
commit09c9c9f7da72b774cc445c0f56fc0b9792a49647
tree33928a1b3e45601c42be1359c2811f5b9c646cb9
parentfe982319aa0aa5bbfc2795791a753832292bd2ba
parent29128a5aa2fa5d8439c8faa92a6ee5ac94723bd5
Auto merge of #79060 - dtolnay:symlinkarg, r=Mark-Simulacrum

Disambiguate symlink argument names

The current argument naming in the following standard library functions is horribly ambiguous.

symlink: https://doc.rust-lang.org/1.47.0/std/os/unix/fs/fn.symlink.html
- std::os::windows::fs::symlink_file: https://doc.rust-lang.org/1.47.0/std/os/windows/fs/fn.symlink_file.html
- std::os::windows::fs::symlink_dir: https://doc.rust-lang.org/1.47.0/std/os/windows/fs/fn.symlink_dir.html

**Notice that Swift uses one of the same names we do (`dst`) to refer to the opposite thing.**

<br>

| | the&nbsp;one&nbsp;that&nbsp;exists | the&nbsp;one&nbsp;that&nbsp;is<br>being&nbsp;created | reference |
| --- | --- | --- | --- |
| Rust | `src` | `dst` | |
| Swift | `withDestinationPath`<br>`destPath` | `atPath`<br>`path` | <sub>https://developer.apple.com/documentation/foundation/filemanager/1411007-createsymboliclink</sub> |
| D | `original` | `link` | <sub>https://dlang.org/library/std/file/symlink.html</sub> |
| Go | `oldname` | `newname` | <sub>https://golang.org/pkg/os/#Symlink</sub> |
| C++| `target` | `link` | <sub>https://en.cppreference.com/w/cpp/filesystem/create_symlink</sub> |
| POSIX | `path1` | `path2` | <sub>https://pubs.opengroup.org/onlinepubs/9699919799/functions/symlink.html</sub> |
| Linux | `target` | `linkpath` | <sub>https://man7.org/linux/man-pages/man2/symlink.2.html</sub> |

Out of these I happen to like D's argument names and am proposing that we adopt them.