about summary refs log tree commit diff
path: root/src/doc/reference.md
diff options
context:
space:
mode:
Diffstat (limited to 'src/doc/reference.md')
-rw-r--r--src/doc/reference.md13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/doc/reference.md b/src/doc/reference.md
index a3e13acccae..d692171f5f2 100644
--- a/src/doc/reference.md
+++ b/src/doc/reference.md
@@ -3344,12 +3344,17 @@ heap.
 A slice is a 'view' into an array. It doesn't own the data it points
 to, it borrows it.
 
-An example of each kind:
+Examples:
 
 ```{rust}
-let vec: Vec<i32> = vec![1, 2, 3];
-let arr: [i32; 3] = [1, 2, 3];
-let s: &[i32] = &vec[..];
+// A stack-allocated array
+let array: [i32; 3] = [1, 2, 3];
+
+// A heap-allocated array
+let vector: Vec<i32> = vec![1, 2, 3];
+
+// A slice into an array
+let slice: &[i32] = &vector[..];
 ```
 
 As you can see, the `vec!` macro allows you to create a `Vec<T>` easily. The