]> git.lizzy.rs Git - rust.git/commitdiff
Rollup merge of #40997 - donniebishop:from_utf8_linking, r=steveklabnik
authorCorey Farwell <coreyf@rwell.org>
Wed, 5 Apr 2017 16:44:30 +0000 (12:44 -0400)
committerGitHub <noreply@github.com>
Wed, 5 Apr 2017 16:44:30 +0000 (12:44 -0400)
Added links to types in from_utf8 description

References #29375. Link to types mentioned in the documentation for `from_utf8` (`str`, `&[u8`], etc). Paragraphs were reformatted to keep any one line from being excessively long, but are otherwise unchanged.

1  2 
src/libcore/str/mod.rs

diff --combined src/libcore/str/mod.rs
index a31c7347a604a160444b9bdf0f6b16b52fc2d786,8356fcd3cbeedfd6b15836683b49d88cfac65dc6..352cc926994e3685ae5ca5554eba5f9fbfd3e3c6
@@@ -152,16 -152,11 +152,16 @@@ impl fmt::Display for ParseBoolError 
  Section: Creating a string
  */
  
 -/// Errors which can occur when attempting to interpret a sequence of `u8`
 +/// Errors which can occur when attempting to interpret a sequence of [`u8`]
  /// as a string.
  ///
 -/// As such, the `from_utf8` family of functions and methods for both `String`s
 -/// and `&str`s make use of this error, for example.
 +/// [`u8`]: ../../std/primitive.u8.html
 +///
 +/// As such, the `from_utf8` family of functions and methods for both [`String`]s
 +/// and [`&str`]s make use of this error, for example.
 +///
 +/// [`String`]: ../../std/string/struct.String.html#method.from_utf8
 +/// [`&str`]: ../../std/str/fn.from_utf8.html
  #[derive(Copy, Eq, PartialEq, Clone, Debug)]
  #[stable(feature = "rust1", since = "1.0.0")]
  pub struct Utf8Error {
@@@ -215,11 -210,15 +215,15 @@@ impl Utf8Error 
  
  /// Converts a slice of bytes to a string slice.
  ///
- /// A string slice (`&str`) is made of bytes (`u8`), and a byte slice (`&[u8]`)
- /// is made of bytes, so this function converts between the two. Not all byte
- /// slices are valid string slices, however: `&str` requires that it is valid
- /// UTF-8. `from_utf8()` checks to ensure that the bytes are valid UTF-8, and
- /// then does the conversion.
+ /// A string slice ([`&str`]) is made of bytes ([`u8`]), and a byte slice
+ /// ([`&[u8]`][byteslice]) is made of bytes, so this function converts between
+ /// the two. Not all byte slices are valid string slices, however: [`&str`] requires
+ /// that it is valid UTF-8. `from_utf8()` checks to ensure that the bytes are valid
+ /// UTF-8, and then does the conversion.
+ ///
+ /// [`&str`]: ../../std/primitive.str.html
+ /// [`u8`]: ../../std/primitive.u8.html
+ /// [byteslice]: ../../std/primitive.slice.html
  ///
  /// If you are sure that the byte slice is valid UTF-8, and you don't want to
  /// incur the overhead of the validity check, there is an unsafe version of
  ///
  /// [string]: ../../std/string/struct.String.html#method.from_utf8
  ///
- /// Because you can stack-allocate a `[u8; N]`, and you can take a `&[u8]` of
- /// it, this function is one way to have a stack-allocated string. There is
- /// an example of this in the examples section below.
+ /// Because you can stack-allocate a `[u8; N]`, and you can take a
+ /// [`&[u8]`][byteslice] of it, this function is one way to have a
+ /// stack-allocated string. There is an example of this in the
+ /// examples section below.
+ ///
+ /// [byteslice]: ../../std/primitive.slice.html
  ///
  /// # Errors
  ///