From a4b7ed7a42c716ab9f05e351f003d589124fd55d Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:18:58 +0200 Subject: Adding upstream version 1.68.2+dfsg1. Signed-off-by: Daniel Baumann --- tests/ui/structs-enums/rec-extend.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 tests/ui/structs-enums/rec-extend.rs (limited to 'tests/ui/structs-enums/rec-extend.rs') diff --git a/tests/ui/structs-enums/rec-extend.rs b/tests/ui/structs-enums/rec-extend.rs new file mode 100644 index 000000000..4c91cd185 --- /dev/null +++ b/tests/ui/structs-enums/rec-extend.rs @@ -0,0 +1,18 @@ +// run-pass + + + + +struct Point {x: isize, y: isize} + +pub fn main() { + let origin: Point = Point {x: 0, y: 0}; + let right: Point = Point {x: origin.x + 10,.. origin}; + let up: Point = Point {y: origin.y + 10,.. origin}; + assert_eq!(origin.x, 0); + assert_eq!(origin.y, 0); + assert_eq!(right.x, 10); + assert_eq!(right.y, 0); + assert_eq!(up.x, 0); + assert_eq!(up.y, 10); +} -- cgit v1.2.3