about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorJonathan Turner <jonathandturner@users.noreply.github.com>2016-08-17 06:25:24 -0700
committerGitHub <noreply@github.com>2016-08-17 06:25:24 -0700
commit997a248c017db838093ddfb06654028721129bfd (patch)
tree39b049eb6750fd1577c453ecc4cabdb0b57ccf45 /src/libstd
parentb8859f6956e313ca4ecd624af3d3ea30a8d44037 (diff)
parent758aff7883b846a9ea01ee6c810f77a4a08c8a48 (diff)
downloadrust-997a248c017db838093ddfb06654028721129bfd.tar.gz
rust-997a248c017db838093ddfb06654028721129bfd.zip
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.
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/primitive_docs.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/libstd/primitive_docs.rs b/src/libstd/primitive_docs.rs
index de891ea8918..84618ba2593 100644
--- a/src/libstd/primitive_docs.rs
+++ b/src/libstd/primitive_docs.rs
@@ -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")]