Skip to content

Commit 769d49a

Browse files
committed
Don't use rust keyword for fake code
1 parent 37ea270 commit 769d49a

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/doc/guide-pointers.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -133,11 +133,11 @@ pass-by-reference. Basically, languages can make two choices (this is made
133133
up syntax, it's not Rust):
134134

135135
```{notrust,ignore}
136-
fn foo(x) {
136+
func foo(x) {
137137
x = 5
138138
}
139139
140-
fn main() {
140+
func main() {
141141
i = 1
142142
foo(i)
143143
// what is the value of i here?
@@ -153,11 +153,11 @@ So what do pointers have to do with this? Well, since pointers point to a
153153
location in memory...
154154

155155
```{notrust,ignore}
156-
fn foo(&int x) {
156+
func foo(&int x) {
157157
*x = 5
158158
}
159159
160-
fn main() {
160+
func main() {
161161
i = 1
162162
foo(&i)
163163
// what is the value of i here?
@@ -192,13 +192,13 @@ When you combine pointers and functions, it's easy to accidentally invalidate
192192
the memory the pointer is pointing to. For example:
193193

194194
```{notrust,ignore}
195-
fn make_pointer(): &int {
195+
func make_pointer(): &int {
196196
x = 5;
197197
198198
return &x;
199199
}
200200
201-
fn main() {
201+
func main() {
202202
&int i = make_pointer();
203203
*i = 5; // uh oh!
204204
}
@@ -214,11 +214,11 @@ issue. Two pointers are said to alias when they point at the same location
214214
in memory. Like this:
215215

216216
```{notrust,ignore}
217-
fn mutate(&int i, int j) {
217+
func mutate(&int i, int j) {
218218
*i = j;
219219
}
220220
221-
fn main() {
221+
func main() {
222222
x = 5;
223223
y = &x;
224224
z = &x; //y and z are aliased

0 commit comments

Comments
 (0)