]> git.lizzy.rs Git - rust.git/blob - tests/ui/rfcs/rfc-2005-default-binding-mode/struct.rs
Rollup merge of #106321 - compiler-errors:delayed-bug-backtrace, r=Nilstrieb
[rust.git] / tests / ui / rfcs / rfc-2005-default-binding-mode / struct.rs
1 // run-pass
2 #[derive(Debug, PartialEq)]
3 struct Foo {
4     x: u8,
5 }
6
7 pub fn main() {
8     let mut foo = Foo {
9         x: 1,
10     };
11
12     match &mut foo {
13         Foo{x: n} => {
14             *n += 1;
15         },
16     };
17
18     assert_eq!(foo, Foo{x: 2});
19
20     let Foo{x: n} = &foo;
21     assert_eq!(*n, 2);
22 }