Skip to content

Commit

Permalink
Rollup merge of rust-lang#35610 - JessRudder:33637-doc-update-for-str…
Browse files Browse the repository at this point in the history
…-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.
  • Loading branch information
Jonathan Turner authored Aug 17, 2016
2 parents b8859f6 + 758aff7 commit 997a248
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/libstd/primitive_docs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand Down

0 comments on commit 997a248

Please sign in to comment.