]> git.lizzy.rs Git - rust.git/blob - src/test/debuginfo/mutable-locs.rs
Merge commit '54a20a02ecd0e1352a871aa0990bcc8b8b03173e' into clippyup
[rust.git] / src / test / debuginfo / mutable-locs.rs
1 // Testing the display of Cell, RefCell, and RefMut in cdb.
2
3 // cdb-only
4 // min-cdb-version: 10.0.18317.1001
5 // compile-flags:-g
6
7 // === CDB TESTS ==================================================================================
8
9 // cdb-command: g
10
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>]
14
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]
18
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>]
23
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]
27
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]
32
33 #![allow(unused_variables)]
34
35 use std::cell::{Cell, RefCell};
36
37 fn main() {
38     let static_c = Cell::new(5);
39     static_c.set(10);
40
41     let dynamic_c = RefCell::new(5);
42     dynamic_c.replace(15);
43
44     let dynamic_c_0 = RefCell::new(15);
45     let mut b = dynamic_c_0.borrow_mut();
46     *b = 42;
47
48     zzz(); // #break
49 }
50
51 fn zzz() {()}