]> git.lizzy.rs Git - rust.git/blob - src/test/debuginfo/rc_arc.rs
Auto merge of #93284 - eholk:disable-drop-range-analysis, r=pnkfelix
[rust.git] / src / test / debuginfo / rc_arc.rs
1 // ignore-windows-gnu: pretty-printers are not loaded
2 // compile-flags:-g
3
4 // min-gdb-version: 8.1
5 // min-cdb-version: 10.0.18317.1001
6
7 // === GDB TESTS ==================================================================================
8
9 // gdb-command:run
10
11 // gdb-command:print r
12 // gdb-check:[...]$1 = Rc(strong=2, weak=1) = {value = 42, strong = 2, weak = 1}
13 // gdb-command:print a
14 // gdb-check:[...]$2 = Arc(strong=2, weak=1) = {value = 42, strong = 2, weak = 1}
15
16
17 // === LLDB TESTS ==================================================================================
18
19 // lldb-command:run
20
21 // lldb-command:print r
22 // lldb-check:[...]$0 = strong=2, weak=1 { value = 42 }
23 // lldb-command:print a
24 // lldb-check:[...]$1 = strong=2, weak=1 { data = 42 }
25
26 // === CDB TESTS ==================================================================================
27
28 // cdb-command:g
29
30 // cdb-command:dx r,d
31 // cdb-check:r,d              : 42 [Type: alloc::rc::Rc<i32>]
32 // cdb-check:    [<Raw View>]     [Type: alloc::rc::Rc<i32>]
33 // cdb-check:    [Reference count] : 2 [Type: core::cell::Cell<usize>]
34 // cdb-check:    [Weak reference count] : 2 [Type: core::cell::Cell<usize>]
35
36 // cdb-command:dx r1,d
37 // cdb-check:r1,d             : 42 [Type: alloc::rc::Rc<i32>]
38 // cdb-check:    [<Raw View>]     [Type: alloc::rc::Rc<i32>]
39 // cdb-check:    [Reference count] : 2 [Type: core::cell::Cell<usize>]
40 // cdb-check:    [Weak reference count] : 2 [Type: core::cell::Cell<usize>]
41
42 // cdb-command:dx w1,d
43 // cdb-check:w1,d             : 42 [Type: alloc::rc::Weak<i32>]
44 // cdb-check:    [<Raw View>]     [Type: alloc::rc::Weak<i32>]
45 // cdb-check:    [Reference count] : 2 [Type: core::cell::Cell<usize>]
46 // cdb-check:    [Weak reference count] : 2 [Type: core::cell::Cell<usize>]
47
48 // cdb-command:dx a,d
49 // cdb-check:a,d              : 42 [Type: alloc::sync::Arc<i32>]
50 // cdb-check:    [<Raw View>]     [Type: alloc::sync::Arc<i32>]
51 // cdb-check:    [Reference count] : 2 [Type: core::sync::atomic::AtomicUsize]
52 // cdb-check:    [Weak reference count] : 2 [Type: core::sync::atomic::AtomicUsize]
53
54 // cdb-command:dx a1,d
55 // cdb-check:a1,d             : 42 [Type: alloc::sync::Arc<i32>]
56 // cdb-check:    [<Raw View>]     [Type: alloc::sync::Arc<i32>]
57 // cdb-check:    [Reference count] : 2 [Type: core::sync::atomic::AtomicUsize]
58 // cdb-check:    [Weak reference count] : 2 [Type: core::sync::atomic::AtomicUsize]
59
60 // cdb-command:dx w2,d
61 // cdb-check:w2,d             : 42 [Type: alloc::sync::Weak<i32>]
62 // cdb-check:    [<Raw View>]     [Type: alloc::sync::Weak<i32>]
63 // cdb-check:    [Reference count] : 2 [Type: core::sync::atomic::AtomicUsize]
64 // cdb-check:    [Weak reference count] : 2 [Type: core::sync::atomic::AtomicUsize]
65
66 use std::rc::Rc;
67 use std::sync::Arc;
68
69 fn main() {
70     let r = Rc::new(42);
71     let r1 = Rc::clone(&r);
72     let w1 = Rc::downgrade(&r);
73
74     let a = Arc::new(42);
75     let a1 = Arc::clone(&a);
76     let w2 = Arc::downgrade(&a);
77
78     zzz(); // #break
79 }
80
81 fn zzz() { () }