2020-11-07 08:28:55 -06:00
|
|
|
// run-pass
|
|
|
|
|
|
|
|
struct Struct<S, T> {
|
|
|
|
a: S,
|
|
|
|
b: T,
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let (mut a, mut b);
|
|
|
|
Struct { a, b } = Struct { a: 0, b: 1 };
|
|
|
|
assert_eq!((a, b), (0, 1));
|
|
|
|
Struct { a: b, b: a } = Struct { a: 1, b: 2 };
|
|
|
|
assert_eq!((a,b), (2, 1));
|
2020-11-11 07:15:15 -06:00
|
|
|
Struct { a: _, b } = Struct { a: 1, b: 2 };
|
|
|
|
assert_eq!((a, b), (2, 2));
|
2020-11-07 08:28:55 -06:00
|
|
|
Struct { a, .. } = Struct { a: 1, b: 3 };
|
2020-11-11 07:15:15 -06:00
|
|
|
assert_eq!((a, b), (1, 2));
|
2020-11-07 08:28:55 -06:00
|
|
|
Struct { .. } = Struct { a: 1, b: 4 };
|
2020-11-11 07:15:15 -06:00
|
|
|
assert_eq!((a, b), (1, 2));
|
2020-11-07 08:28:55 -06:00
|
|
|
}
|