Rollup merge of #35610 - JessRudder:33637-doc-update-for-str-representaton, r=steveklabnik

Add note to docs for &str that example is to demo internals only

r? @steveklabnik

This adds a note below the &str representation example explaining that the example provided should not be used under normal circumstances..

Would it make sense to point people in the direction of the method(s) they should use instead?  I left it out in the interest of not complicating the documentation, but, there's definitely an argument to be made for adding a bit of guidance in there.
This commit is contained in:
Jonathan Turner 2016-08-17 06:25:24 -07:00 committed by GitHub
commit 997a248c01

View File

@ -385,6 +385,10 @@ mod prim_slice { }
///
/// [`.as_ptr()`]: #method.as_ptr
/// [`len()`]: #method.len
///
/// Note: This example shows the internals of `&str`. `unsafe` should not be
/// used to get a string slice under normal circumstances. Use `.as_slice()`
/// instead.
mod prim_str { }
#[doc(primitive = "tuple")]