diff options
| author | kennytm <kennytm@gmail.com> | 2018-01-13 02:26:42 +0800 |
|---|---|---|
| committer | kennytm <kennytm@gmail.com> | 2018-01-13 03:17:03 +0800 |
| commit | db36d18b9d7afc0bf35a600274ff7e219af4b157 (patch) | |
| tree | fabe6a7a1b048c6edf0d450e243cf1bbfbe0fdf4 /src | |
| parent | a63121c59a9f17ff846176165a7037f3736ab903 (diff) | |
| parent | 80028760ed111b800decee876af59741f8765cce (diff) | |
| download | rust-db36d18b9d7afc0bf35a600274ff7e219af4b157.tar.gz rust-db36d18b9d7afc0bf35a600274ff7e219af4b157.zip | |
Rollup merge of #47357 - whentze:osstr-doc-fix, r=GuillaumeGomez
Fix docs for OsStr At present, there are two small issues with the [docs](https://doc.rust-lang.org/std/ffi/struct.OsStr.html) for std::ffi::OsStr: - The docs say "OsStr is to OsString as String is to &str: the former in each pair are borrowed references; the latter are owned strings.". The latter pair is mixed up: String is the owned variant whereas &str is the borrowed reference. - The doc links to String and &str are broken and render as [String] and [&str]. This PR fixes these issues.
Diffstat (limited to 'src')
| -rw-r--r-- | src/libstd/ffi/os_str.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/libstd/ffi/os_str.rs b/src/libstd/ffi/os_str.rs index 109173d31c5..3959e8533be 100644 --- a/src/libstd/ffi/os_str.rs +++ b/src/libstd/ffi/os_str.rs @@ -36,7 +36,7 @@ use sys_common::{AsInner, IntoInner, FromInner}; /// and platform-native string values, and in particular allowing a Rust string /// to be converted into an "OS" string with no cost if possible. /// -/// `OsString` is to [`OsStr`] as [`String`] is to [`&str`]: the former +/// `OsString` is to [`&OsStr`] as [`String`] is to [`&str`]: the former /// in each pair are owned strings; the latter are borrowed /// references. /// @@ -64,6 +64,7 @@ use sys_common::{AsInner, IntoInner, FromInner}; /// the traits which `OsString` implements for conversions from/to native representations. /// /// [`OsStr`]: struct.OsStr.html +/// [`&OsStr`]: struct.OsStr.html /// [`From`]: ../convert/trait.From.html /// [`String`]: ../string/struct.String.html /// [`&str`]: ../primitive.str.html @@ -84,13 +85,15 @@ pub struct OsString { /// This type represents a borrowed reference to a string in the operating system's preferred /// representation. /// -/// `OsStr` is to [`OsString`] as [`String`] is to [`&str`]: the former in each pair are borrowed +/// `&OsStr` is to [`OsString`] as [`&str`] is to [`String`]: the former in each pair are borrowed /// references; the latter are owned strings. /// /// See the [module's toplevel documentation about conversions][conversions] for a discussion on /// the traits which `OsStr` implements for conversions from/to native representations. /// /// [`OsString`]: struct.OsString.html +/// [`&str`]: ../primitive.str.html +/// [`String`]: ../string/struct.String.html /// [conversions]: index.html#conversions #[stable(feature = "rust1", since = "1.0.0")] pub struct OsStr { |
