]> git.proxmox.com Git - rustc.git/blob - tests/ui/borrowck/move-in-pattern.fixed
New upstream version 1.68.2+dfsg1
[rustc.git] / tests / ui / borrowck / move-in-pattern.fixed
1 // run-rustfix
2 // Issue #63988
3 #[derive(Debug)]
4 struct S;
5 fn foo(_: Option<S>) {}
6
7 enum E {
8 V {
9 s: S,
10 }
11 }
12 fn bar(_: E) {}
13
14 fn main() {
15 let s = Some(S);
16 if let Some(ref x) = s {
17 let _ = x;
18 }
19 foo(s); //~ ERROR use of partially moved value: `s`
20 let e = E::V { s: S };
21 let E::V { s: ref x } = e;
22 let _ = x;
23 bar(e); //~ ERROR use of partially moved value: `e`
24 }