Skip to content

Commit 3712551

Browse files
committed
auto merge of #14566 : cburgdorf/rust/patch-1, r=cmr
Renamed `owned_box` to `on_the_heap` to use a consistent naming across the tutorial and the life time guide. Also it makes the example easier to grasp.
2 parents 60b4a97 + b657af8 commit 3712551

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/doc/tutorial.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1429,7 +1429,7 @@ contains a point, but allocated in a different location:
14291429
~~~
14301430
# struct Point { x: f64, y: f64 }
14311431
let on_the_stack : Point = Point { x: 3.0, y: 4.0 };
1432-
let owned_box : Box<Point> = box Point { x: 7.0, y: 9.0 };
1432+
let on_the_heap : Box<Point> = box Point { x: 7.0, y: 9.0 };
14331433
~~~
14341434

14351435
Suppose we want to write a procedure that computes the distance
@@ -1454,9 +1454,9 @@ Now we can call `compute_distance()` in various ways:
14541454
~~~
14551455
# struct Point{ x: f64, y: f64 };
14561456
# let on_the_stack : Point = Point { x: 3.0, y: 4.0 };
1457-
# let owned_box : Box<Point> = box Point { x: 7.0, y: 9.0 };
1457+
# let on_the_heap : Box<Point> = box Point { x: 7.0, y: 9.0 };
14581458
# fn compute_distance(p1: &Point, p2: &Point) -> f64 { 0.0 }
1459-
compute_distance(&on_the_stack, owned_box);
1459+
compute_distance(&on_the_stack, on_the_heap);
14601460
~~~
14611461

14621462
Here the `&` operator is used to take the address of the variable

0 commit comments

Comments
 (0)