]> git.proxmox.com Git - rustc.git/blob - src/test/ui/moves/moves-based-on-type-cyclic-types-issue-4821.rs
New upstream version 1.67.1+dfsg1
[rustc.git] / src / test / ui / moves / moves-based-on-type-cyclic-types-issue-4821.rs
1 // Test for a subtle failure computing kinds of cyclic types, in which
2 // temporary kinds wound up being stored in a cache and used later.
3 // See rustc::ty::type_contents() for more information.
4
5
6 struct List { key: isize, next: Option<Box<List>> }
7
8 fn foo(node: Box<List>) -> isize {
9 let r = match node.next {
10 Some(right) => consume(right),
11 None => 0
12 };
13 consume(node) + r //~ ERROR use of partially moved value: `node`
14 }
15
16 fn consume(v: Box<List>) -> isize {
17 v.key
18 }
19
20 fn main() {}