about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorManish Goregaokar <manishsmail@gmail.com>2015-06-04 11:26:31 +0530
committerManish Goregaokar <manishsmail@gmail.com>2015-06-04 11:26:31 +0530
commitfd3b6ca508ed99004a11291ef1d2c64104102a41 (patch)
tree793e5ae3048db402432ab0b5a611c9bc0d301279 /src
parent5ef76142439d7ec65acc0e4e2fe56e7fa6476507 (diff)
downloadrust-fd3b6ca508ed99004a11291ef1d2c64104102a41.tar.gz
rust-fd3b6ca508ed99004a11291ef1d2c64104102a41.zip
Fix doctest (fixup –#25900)
Diffstat (limited to 'src')
-rw-r--r--src/doc/reference.md33
1 files changed, 17 insertions, 16 deletions
diff --git a/src/doc/reference.md b/src/doc/reference.md
index 045481d7bbd..d56ecb360cf 100644
--- a/src/doc/reference.md
+++ b/src/doc/reference.md
@@ -3699,28 +3699,29 @@ Coercion is allowed between the following types:
 * `&mut T` to `*mut T`.
 
 * `&T` to `&U` if `T` implements `Deref<Target = U>`. For example:
-    ```
-    use std::ops::Deref;
 
-    struct CharContainer {
-        value: char
-    }
+```rust
+use std::ops::Deref;
 
-    impl Deref for CharContainer {
-        type Target = char;
+struct CharContainer {
+    value: char
+}
 
-        fn deref<'a>(&'a self) -> &'a char {
-            &self.value
-        }
+impl Deref for CharContainer {
+    type Target = char;
+
+    fn deref<'a>(&'a self) -> &'a char {
+        &self.value
     }
+}
 
-    fn foo(arg: &char) {}
+fn foo(arg: &char) {}
 
-    fn main() {
-        let x = &mut CharContainer { value: 'y' };
-        foo(x); //&mut CharContainer is coerced to &char.
-    }
-    ```
+fn main() {
+    let x = &mut CharContainer { value: 'y' };
+    foo(x); //&mut CharContainer is coerced to &char.
+}
+```
 * `&mut T` to `&mut U` if `T` implements `DerefMut<Target = U>`.
 
 * TyCtor(`T`) to TyCtor(coerce_inner(`T`)), where TyCtor(`T`) is one of