]>
git.proxmox.com Git - rustc.git/blob - tests/debuginfo/mutable-locs.rs
1 // Testing the display of Cell, RefCell, and RefMut in cdb.
4 // min-cdb-version: 10.0.18317.1001
7 // === CDB TESTS ==================================================================================
11 // cdb-command:dx static_c,d
12 // cdb-check:static_c,d : 10 [Type: core::cell::Cell<i32>]
13 // cdb-check: [<Raw View>] [Type: core::cell::Cell<i32>]
15 // cdb-command: dx static_c.value,d
16 // cdb-check:static_c.value,d : 10 [Type: core::cell::UnsafeCell<i32>]
17 // cdb-check: [<Raw View>] [Type: core::cell::UnsafeCell<i32>]
19 // cdb-command: dx dynamic_c,d
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
24 // cdb-command: dx dynamic_c.value,d
25 // cdb-check:dynamic_c.value,d : 15 [Type: core::cell::UnsafeCell<i32>]
26 // cdb-check: [<Raw View>] [Type: core::cell::UnsafeCell<i32>]
28 // cdb-command: dx b,d
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]
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
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]
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
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
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]
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
71 #![allow(unused_variables)]
73 use std
::cell
::{Cell, RefCell}
;
76 let static_c
= Cell
::new(5);
79 let dynamic_c
= RefCell
::new(5);
80 dynamic_c
.replace(15);
82 let dynamic_c_0
= RefCell
::new(15);
83 let mut b
= dynamic_c_0
.borrow_mut();
88 // Check that `RefCell`'s borrow state visualizes correctly
90 let r_borrow
= dynamic_c
.borrow();
97 let r_borrow_mut
= dynamic_c
.borrow_mut();