diff options
| author | Wesley Wiser <wesleywiser@microsoft.com> | 2021-06-29 15:32:03 -0400 |
|---|---|---|
| committer | Wesley Wiser <wesleywiser@microsoft.com> | 2021-07-08 12:55:49 -0400 |
| commit | cad42e0d330d8d3476f2217fe4f14f2f5e34e691 (patch) | |
| tree | c3b94837db57ba08693a5d8d6d5d42fc2afba29c /src/test/debuginfo | |
| parent | 9740dcc82f39c2a7f1700ebbb2f0edb53388a44b (diff) | |
| download | rust-cad42e0d330d8d3476f2217fe4f14f2f5e34e691.tar.gz rust-cad42e0d330d8d3476f2217fe4f14f2f5e34e691.zip | |
Add natvis for cell types
Diffstat (limited to 'src/test/debuginfo')
| -rw-r--r-- | src/test/debuginfo/mutable-locs.rs | 77 | ||||
| -rw-r--r-- | src/test/debuginfo/rwlock-read.rs | 6 |
2 files changed, 68 insertions, 15 deletions
diff --git a/src/test/debuginfo/mutable-locs.rs b/src/test/debuginfo/mutable-locs.rs index 428a7e8d9c0..688483e43e4 100644 --- a/src/test/debuginfo/mutable-locs.rs +++ b/src/test/debuginfo/mutable-locs.rs @@ -9,26 +9,64 @@ // cdb-command: g // cdb-command:dx static_c,d -// cdb-check:static_c,d [Type: core::cell::Cell<i32>] -// cdb-check: [...] value [Type: core::cell::UnsafeCell<i32>] +// cdb-check:static_c,d : 10 [Type: core::cell::Cell<i32>] +// cdb-check: [<Raw View>] [Type: core::cell::Cell<i32>] // cdb-command: dx static_c.value,d -// cdb-check:static_c.value,d [Type: core::cell::UnsafeCell<i32>] -// cdb-check: [...] value : 10 [Type: int] +// cdb-check:static_c.value,d : 10 [Type: core::cell::UnsafeCell<i32>] +// cdb-check: [<Raw View>] [Type: core::cell::UnsafeCell<i32>] // cdb-command: dx dynamic_c,d -// cdb-check:dynamic_c,d [Type: core::cell::RefCell<i32>] -// cdb-check: [...] borrow [Type: core::cell::Cell<isize>] -// cdb-check: [...] value [Type: core::cell::UnsafeCell<i32>] +// cdb-check:dynamic_c,d : 15 [Type: core::cell::RefCell<i32>] +// cdb-check: [<Raw View>] [Type: core::cell::RefCell<i32>] +// cdb-check: [Borrow state] : Unborrowed // cdb-command: dx dynamic_c.value,d -// cdb-check:dynamic_c.value,d [Type: core::cell::UnsafeCell<i32>] -// cdb-check: [...] value : 15 [Type: int] +// cdb-check:dynamic_c.value,d : 15 [Type: core::cell::UnsafeCell<i32>] +// cdb-check: [<Raw View>] [Type: core::cell::UnsafeCell<i32>] // cdb-command: dx b,d -// cdb-check:b,d [Type: core::cell::RefMut<i32>] -// cdb-check: [...] value : [...] : 42 [Type: int *] -// cdb-check: [...] borrow [Type: core::cell::BorrowRefMut] +// cdb-check:b,d : 42 [Type: core::cell::RefMut<i32>] +// cdb-check: [<Raw View>] [Type: core::cell::RefMut<i32>] +// cdb-check: 42 [Type: int] + +// cdb-command: g + +// cdb-command: dx dynamic_c,d +// cdb-check:dynamic_c,d : 15 [Type: core::cell::RefCell<i32>] +// cdb-check: [<Raw View>] [Type: core::cell::RefCell<i32>] +// cdb-check: [Borrow state] : Immutably borrowed + +// cdb-command: dx r_borrow,d +// cdb-check:r_borrow,d : 15 [Type: core::cell::Ref<i32>] +// cdb-check: [<Raw View>] [Type: core::cell::Ref<i32>] +// cdb-check: 15 [Type: int] + +// cdb-command: g + +// cdb-command: dx dynamic_c,d +// cdb-check:dynamic_c,d : 15 [Type: core::cell::RefCell<i32>] +// cdb-check: [<Raw View>] [Type: core::cell::RefCell<i32>] +// cdb-check: [Borrow state] : Unborrowed + +// cdb-command: g + +// cdb-command: dx dynamic_c,d +// cdb-check:dynamic_c,d : 15 [Type: core::cell::RefCell<i32>] +// cdb-check: [<Raw View>] [Type: core::cell::RefCell<i32>] +// cdb-check: [Borrow state] : Mutably borrowed + +// cdb-command: dx r_borrow_mut,d +// cdb-check:r_borrow_mut,d : 15 [Type: core::cell::RefMut<i32>] +// cdb-check: [<Raw View>] [Type: core::cell::RefMut<i32>] +// cdb-check: 15 [Type: int] + +// cdb-command: g + +// cdb-command: dx dynamic_c,d +// cdb-check:dynamic_c,d : 15 [Type: core::cell::RefCell<i32>] +// cdb-check: [<Raw View>] [Type: core::cell::RefCell<i32>] +// cdb-check: [Borrow state] : Unborrowed #![allow(unused_variables)] @@ -46,6 +84,21 @@ fn main() { *b = 42; zzz(); // #break + + // Check that `RefCell`'s borrow state visualizes correctly + { + let r_borrow = dynamic_c.borrow(); + zzz(); // #break + } + + zzz(); // #break + + { + let r_borrow_mut = dynamic_c.borrow_mut(); + zzz(); // #break + } + + zzz(); // #break } fn zzz() {()} diff --git a/src/test/debuginfo/rwlock-read.rs b/src/test/debuginfo/rwlock-read.rs index ac652c8ccf4..e1c10a4d37f 100644 --- a/src/test/debuginfo/rwlock-read.rs +++ b/src/test/debuginfo/rwlock-read.rs @@ -11,15 +11,15 @@ // cdb-command:dx l // cdb-check:l [Type: std::sync::rwlock::RwLock<i32>] // cdb-check: [...] poison [Type: std::sync::poison::Flag] -// cdb-check: [...] data [Type: core::cell::UnsafeCell<i32>] +// cdb-check: [...] data : 0 [Type: core::cell::UnsafeCell<i32>] // // cdb-command:dx r // cdb-check:r [Type: std::sync::rwlock::RwLockReadGuard<i32>] // cdb-check: [...] lock : [...] [Type: std::sync::rwlock::RwLock<i32> *] // // cdb-command:dx r.lock->data,d -// cdb-check:r.lock->data,d [Type: core::cell::UnsafeCell<i32>] -// cdb-check: [...] value : 0 [Type: int] +// cdb-check:r.lock->data,d : 0 [Type: core::cell::UnsafeCell<i32>] +// cdb-check: [<Raw View>] [Type: core::cell::UnsafeCell<i32>] #[allow(unused_variables)] |
