Skip to content

Commit db36d18

Browse files
committed
Rollup merge of rust-lang#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.
2 parents a63121c + 8002876 commit db36d18

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/libstd/ffi/os_str.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ use sys_common::{AsInner, IntoInner, FromInner};
3636
/// and platform-native string values, and in particular allowing a Rust string
3737
/// to be converted into an "OS" string with no cost if possible.
3838
///
39-
/// `OsString` is to [`OsStr`] as [`String`] is to [`&str`]: the former
39+
/// `OsString` is to [`&OsStr`] as [`String`] is to [`&str`]: the former
4040
/// in each pair are owned strings; the latter are borrowed
4141
/// references.
4242
///
@@ -64,6 +64,7 @@ use sys_common::{AsInner, IntoInner, FromInner};
6464
/// the traits which `OsString` implements for conversions from/to native representations.
6565
///
6666
/// [`OsStr`]: struct.OsStr.html
67+
/// [`&OsStr`]: struct.OsStr.html
6768
/// [`From`]: ../convert/trait.From.html
6869
/// [`String`]: ../string/struct.String.html
6970
/// [`&str`]: ../primitive.str.html
@@ -84,13 +85,15 @@ pub struct OsString {
8485
/// This type represents a borrowed reference to a string in the operating system's preferred
8586
/// representation.
8687
///
87-
/// `OsStr` is to [`OsString`] as [`String`] is to [`&str`]: the former in each pair are borrowed
88+
/// `&OsStr` is to [`OsString`] as [`&str`] is to [`String`]: the former in each pair are borrowed
8889
/// references; the latter are owned strings.
8990
///
9091
/// See the [module's toplevel documentation about conversions][conversions] for a discussion on
9192
/// the traits which `OsStr` implements for conversions from/to native representations.
9293
///
9394
/// [`OsString`]: struct.OsString.html
95+
/// [`&str`]: ../primitive.str.html
96+
/// [`String`]: ../string/struct.String.html
9497
/// [conversions]: index.html#conversions
9598
#[stable(feature = "rust1", since = "1.0.0")]
9699
pub struct OsStr {

0 commit comments

Comments
 (0)