9
9
// cdb-command: g
10
10
11
11
// cdb-command:dx static_c,d
12
- // cdb-check:static_c,d [Type: core::cell::Cell<i32>]
13
- // cdb-check: [...] value [Type: core::cell::UnsafeCell <i32>]
12
+ // cdb-check:static_c,d : 10 [Type: core::cell::Cell<i32>]
13
+ // cdb-check: [<Raw View>] [Type: core::cell::Cell <i32>]
14
14
15
15
// cdb-command: dx static_c.value,d
16
- // cdb-check:static_c.value,d [Type: core::cell::UnsafeCell<i32>]
17
- // cdb-check: [...] value : 10 [Type: int ]
16
+ // cdb-check:static_c.value,d : 10 [Type: core::cell::UnsafeCell<i32>]
17
+ // cdb-check: [<Raw View>] [Type: core::cell::UnsafeCell<i32> ]
18
18
19
19
// cdb-command: dx dynamic_c,d
20
- // cdb-check:dynamic_c,d [Type: core::cell::RefCell<i32>]
21
- // cdb-check: [...] borrow [Type: core::cell::Cell<isize >]
22
- // cdb-check: [...] value [Type: core::cell::UnsafeCell<i32>]
20
+ // cdb-check:dynamic_c,d : 15 [Type: core::cell::RefCell<i32>]
21
+ // cdb-check: [<Raw View>] [Type: core::cell::RefCell<i32 >]
22
+ // cdb-check: [Borrow state] : Unborrowed
23
23
24
24
// cdb-command: dx dynamic_c.value,d
25
- // cdb-check:dynamic_c.value,d [Type: core::cell::UnsafeCell<i32>]
26
- // cdb-check: [...] value : 15 [Type: int ]
25
+ // cdb-check:dynamic_c.value,d : 15 [Type: core::cell::UnsafeCell<i32>]
26
+ // cdb-check: [<Raw View>] [Type: core::cell::UnsafeCell<i32> ]
27
27
28
28
// cdb-command: dx b,d
29
- // cdb-check:b,d [Type: core::cell::RefMut<i32>]
30
- // cdb-check: [...] value : [...] : 42 [Type: int *]
31
- // cdb-check: [...] borrow [Type: core::cell::BorrowRefMut]
29
+ // cdb-check:b,d : 42 [Type: core::cell::RefMut<i32>]
30
+ // cdb-check: [<Raw View>] [Type: core::cell::RefMut<i32>]
31
+ // cdb-check: 42 [Type: int]
32
+
33
+ // cdb-command: g
34
+
35
+ // cdb-command: dx dynamic_c,d
36
+ // cdb-check:dynamic_c,d : 15 [Type: core::cell::RefCell<i32>]
37
+ // cdb-check: [<Raw View>] [Type: core::cell::RefCell<i32>]
38
+ // cdb-check: [Borrow state] : Immutably borrowed
39
+
40
+ // cdb-command: dx r_borrow,d
41
+ // cdb-check:r_borrow,d : 15 [Type: core::cell::Ref<i32>]
42
+ // cdb-check: [<Raw View>] [Type: core::cell::Ref<i32>]
43
+ // cdb-check: 15 [Type: int]
44
+
45
+ // cdb-command: g
46
+
47
+ // cdb-command: dx dynamic_c,d
48
+ // cdb-check:dynamic_c,d : 15 [Type: core::cell::RefCell<i32>]
49
+ // cdb-check: [<Raw View>] [Type: core::cell::RefCell<i32>]
50
+ // cdb-check: [Borrow state] : Unborrowed
51
+
52
+ // cdb-command: g
53
+
54
+ // cdb-command: dx dynamic_c,d
55
+ // cdb-check:dynamic_c,d : 15 [Type: core::cell::RefCell<i32>]
56
+ // cdb-check: [<Raw View>] [Type: core::cell::RefCell<i32>]
57
+ // cdb-check: [Borrow state] : Mutably borrowed
58
+
59
+ // cdb-command: dx r_borrow_mut,d
60
+ // cdb-check:r_borrow_mut,d : 15 [Type: core::cell::RefMut<i32>]
61
+ // cdb-check: [<Raw View>] [Type: core::cell::RefMut<i32>]
62
+ // cdb-check: 15 [Type: int]
63
+
64
+ // cdb-command: g
65
+
66
+ // cdb-command: dx dynamic_c,d
67
+ // cdb-check:dynamic_c,d : 15 [Type: core::cell::RefCell<i32>]
68
+ // cdb-check: [<Raw View>] [Type: core::cell::RefCell<i32>]
69
+ // cdb-check: [Borrow state] : Unborrowed
32
70
33
71
#![ allow( unused_variables) ]
34
72
@@ -46,6 +84,21 @@ fn main() {
46
84
* b = 42 ;
47
85
48
86
zzz ( ) ; // #break
87
+
88
+ // Check that `RefCell`'s borrow state visualizes correctly
89
+ {
90
+ let r_borrow = dynamic_c. borrow ( ) ;
91
+ zzz ( ) ; // #break
92
+ }
93
+
94
+ zzz ( ) ; // #break
95
+
96
+ {
97
+ let r_borrow_mut = dynamic_c. borrow_mut ( ) ;
98
+ zzz ( ) ; // #break
99
+ }
100
+
101
+ zzz ( ) ; // #break
49
102
}
50
103
51
104
fn zzz ( ) { ( ) }
0 commit comments