about summary refs log tree commit diff
path: root/tests/debuginfo/recursive-enum.rs
blob: 5fb339f54f3968dfec9a4808ec1fa0e4293a28ff (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
//@ ignore-lldb

//@ compile-flags:-g
//@ disable-gdb-pretty-printers
// gdb-command:run

// Test whether compiling a recursive enum definition crashes debug info generation. The test case
// is taken from issue #11083 and #135093.

#![allow(unused_variables)]

pub struct Window<'a> {
    callbacks: WindowCallbacks<'a>
}

struct WindowCallbacks<'a> {
    pos_callback: Option<Box<FnMut(&Window, i32, i32) + 'a>>,
}

enum ExpandingRecursive<T> {
    Recurse(Indirect<T>),
    Item(T),
}

struct Indirect<U> {
    rec: *const ExpandingRecursive<Option<U>>,
}


fn main() {
    let x = WindowCallbacks { pos_callback: None };

    // EXPANDING RECURSIVE
    let expanding_recursive: ExpandingRecursive<u64> = ExpandingRecursive::Recurse(Indirect {
        rec: &ExpandingRecursive::Item(Option::Some(42)),
    });
}