Skip to content

Commit

Permalink
Rollup merge of rust-lang#47357 - whentze:osstr-doc-fix, r=GuillaumeG…
Browse files Browse the repository at this point in the history
…omez

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.
  • Loading branch information
kennytm committed Jan 12, 2018
2 parents a63121c + 8002876 commit db36d18
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/libstd/ffi/os_str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
///
Expand Down Expand Up @@ -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
Expand All @@ -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 {
Expand Down

0 comments on commit db36d18

Please sign in to comment.