about summary refs log tree commit diff
diff options
context:
space:
mode:
authorManish Goregaokar <manishsmail@gmail.com>2015-03-09 00:09:56 +0530
committerManish Goregaokar <manishsmail@gmail.com>2015-03-09 00:09:56 +0530
commitc7d5354567e596c578b1ff656f52fae80a93b48a (patch)
tree5626cf1866186339ba015d939d2b89cf54f3f696
parentd1ac69ce72ce964279de099b7887460f9c6a8024 (diff)
parentce223a62f1da97327ae2ef3e5e59095a639bc20f (diff)
downloadrust-c7d5354567e596c578b1ff656f52fae80a93b48a.tar.gz
rust-c7d5354567e596c578b1ff656f52fae80a93b48a.zip
Rollup merge of #23181 - steveklabnik:gh22637, r=alexcrichton
 Fixes #22637
-rw-r--r--src/doc/trpl/more-strings.md17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/doc/trpl/more-strings.md b/src/doc/trpl/more-strings.md
index a2a558094e1..6567cd448f9 100644
--- a/src/doc/trpl/more-strings.md
+++ b/src/doc/trpl/more-strings.md
@@ -278,7 +278,18 @@ This will print:
 
 Many more bytes than graphemes!
 
-# Other Documentation
+# `Deref` coercions
 
-* [the `&str` API documentation](../std/str/index.html)
-* [the `String` API documentation](../std/string/index.html)
+References to `String`s will automatically coerce into `&str`s. Like this:
+
+```
+fn hello(s: &str) {
+   println!("Hello, {}!", s);
+}
+
+let slice = "Steve";
+let string = "Steve".to_string();
+
+hello(slice);
+hello(&string);
+```