summaryrefslogtreecommitdiffstats
path: root/tests/ui/output-slot-variants.rs
blob: 7c20a2b2f94e8d3fc223c5bb2ef15fa841da5f9a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
// run-pass

#![allow(dead_code)]
#![allow(unused_assignments)]
#![allow(unknown_lints)]
// pretty-expanded FIXME #23616

#![allow(dead_assignment)]
#![allow(unused_variables)]

struct A { a: isize, b: isize }
struct Abox { a: Box<isize>, b: Box<isize> }

fn ret_int_i() -> isize { 10 }

fn ret_ext_i() -> Box<isize> { Box::new(10) }

fn ret_int_rec() -> A { A {a: 10, b: 10} }

fn ret_ext_rec() -> Box<A> { Box::new(A {a: 10, b: 10}) }

fn ret_ext_mem() -> Abox { Abox {a: Box::new(10), b: Box::new(10) } }

fn ret_ext_ext_mem() -> Box<Abox> { Box::new(Abox{a: Box::new(10), b: Box::new(10) }) }

pub fn main() {
    let mut int_i: isize;
    let mut ext_i: Box<isize>;
    let mut int_rec: A;
    let mut ext_rec: Box<A>;
    let mut ext_mem: Abox;
    let mut ext_ext_mem: Box<Abox>;
    int_i = ret_int_i(); // initializing

    int_i = ret_int_i(); // non-initializing

    int_i = ret_int_i(); // non-initializing

    ext_i = ret_ext_i(); // initializing

    ext_i = ret_ext_i(); // non-initializing

    ext_i = ret_ext_i(); // non-initializing

    int_rec = ret_int_rec(); // initializing

    int_rec = ret_int_rec(); // non-initializing

    int_rec = ret_int_rec(); // non-initializing

    ext_rec = ret_ext_rec(); // initializing

    ext_rec = ret_ext_rec(); // non-initializing

    ext_rec = ret_ext_rec(); // non-initializing

    ext_mem = ret_ext_mem(); // initializing

    ext_mem = ret_ext_mem(); // non-initializing

    ext_mem = ret_ext_mem(); // non-initializing

    ext_ext_mem = ret_ext_ext_mem(); // initializing

    ext_ext_mem = ret_ext_ext_mem(); // non-initializing

    ext_ext_mem = ret_ext_ext_mem(); // non-initializing

}