]> git.lizzy.rs Git - rust.git/blob - src/test/ui/borrowck/move-in-pattern.fixed
Provide suggestions for some moved value errors
[rust.git] / src / test / 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 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 moved value: `e`
24 }