From bee791ccf80fd2cf42bb1e0f173fa92e6dca5123 Mon Sep 17 00:00:00 2001 From: Arpit Gaur Date: Thu, 1 Feb 2024 15:07:28 +0000 Subject: [PATCH] Fixes the bug: https://github.com/rust-lang/rust-by-example/issues/1721 --- src/custom_types/structs.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/custom_types/structs.md b/src/custom_types/structs.md index 29d9b8a8ff..84610547b2 100644 --- a/src/custom_types/structs.md +++ b/src/custom_types/structs.md @@ -48,13 +48,14 @@ fn main() { // Instantiate a `Point` let point: Point = Point { x: 10.3, y: 0.4 }; + let another_point: Point = Point { x: 5.2, y: 0.2 }; // Access the fields of the point println!("point coordinates: ({}, {})", point.x, point.y); // Make a new point by using struct update syntax to use the fields of our // other one - let bottom_right = Point { x: 5.2, ..point }; + let bottom_right = Point { x: 5.2, ..another_point }; // `bottom_right.y` will be the same as `point.y` because we used that field // from `point`