@@ -84,7 +84,7 @@ println!("{}", x + z);
8484
8585This gives us an error:
8686
87- ``` {notrust}
87+ ``` text
8888hello.rs:6:24: 6:25 error: mismatched types: expected `int` but found `&int` (expected int but found &-ptr)
8989hello.rs:6 println!("{}", x + z);
9090 ^
@@ -132,7 +132,7 @@ Pointers are useful in languages that are pass-by-value, rather than
132132pass-by-reference. Basically, languages can make two choices (this is made
133133up syntax, it's not Rust):
134134
135- ``` {ignore}
135+ ``` text
136136func foo(x) {
137137 x = 5
138138}
@@ -152,7 +152,7 @@ and therefore, can change its value. At the comment, `i` will be `5`.
152152So what do pointers have to do with this? Well, since pointers point to a
153153location in memory...
154154
155- ``` {ignore}
155+ ``` text
156156func foo(&int x) {
157157 *x = 5
158158}
@@ -191,7 +191,7 @@ knows. This might be harmless, and it might be catastrophic.
191191When you combine pointers and functions, it's easy to accidentally invalidate
192192the memory the pointer is pointing to. For example:
193193
194- ``` {ignore}
194+ ``` text
195195func make_pointer(): &int {
196196 x = 5;
197197
@@ -213,7 +213,7 @@ As one last example of a big problem with pointers, **aliasing** can be an
213213issue. Two pointers are said to alias when they point at the same location
214214in memory. Like this:
215215
216- ``` {ignore}
216+ ``` text
217217func mutate(&int i, int j) {
218218 *i = j;
219219}
@@ -398,7 +398,7 @@ fn main() {
398398
399399It gives this error:
400400
401- ``` {notrust}
401+ ``` text
402402test.rs:5:8: 5:10 error: cannot assign to `*x` because it is borrowed
403403test.rs:5 *x -= 1;
404404 ^~
@@ -522,7 +522,7 @@ boxes, though. As a rough approximation, you can treat this Rust code:
522522
523523As being similar to this C code:
524524
525- ``` {ignore}
525+ ``` c
526526{
527527 int *x;
528528 x = (int *)malloc(sizeof(int));
@@ -626,7 +626,7 @@ fn main() {
626626
627627This prints:
628628
629- ``` {ignore}
629+ ``` text
630630Cons(1, box Cons(2, box Cons(3, box Nil)))
631631```
632632
0 commit comments