mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-01 06:51:58 +00:00
Add natvis for cell types
This commit is contained in:
parent
9740dcc82f
commit
cad42e0d33
@ -1,5 +1,39 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
|
||||
<Type Name="core::cell::Cell<*>">
|
||||
<DisplayString>{value.value}</DisplayString>
|
||||
<Expand>
|
||||
<ExpandedItem>value.value</ExpandedItem>
|
||||
</Expand>
|
||||
</Type>
|
||||
<Type Name="core::cell::Ref<*>">
|
||||
<DisplayString>{value}</DisplayString>
|
||||
<Expand>
|
||||
<ExpandedItem>value</ExpandedItem>
|
||||
</Expand>
|
||||
</Type>
|
||||
<Type Name="core::cell::RefMut<*>">
|
||||
<DisplayString>{value}</DisplayString>
|
||||
<Expand>
|
||||
<ExpandedItem>value</ExpandedItem>
|
||||
</Expand>
|
||||
</Type>
|
||||
<Type Name="core::cell::RefCell<*>">
|
||||
<DisplayString>{value.value}</DisplayString>
|
||||
<Expand>
|
||||
<Item Name="[Borrow state]" Condition="borrow.value.value == 0">"Unborrowed",sb</Item>
|
||||
<Item Name="[Borrow state]" Condition="borrow.value.value > 0">"Immutably borrowed",sb</Item>
|
||||
<Item Name="[Borrow state]" Condition="borrow.value.value < 0">"Mutably borrowed",sb</Item>
|
||||
<ExpandedItem>value.value</ExpandedItem>
|
||||
</Expand>
|
||||
</Type>
|
||||
<Type Name="core::cell::UnsafeCell<*>">
|
||||
<DisplayString>{value}</DisplayString>
|
||||
<Expand>
|
||||
<ExpandedItem>value</ExpandedItem>
|
||||
</Expand>
|
||||
</Type>
|
||||
|
||||
<Type Name="core::num::nonzero::NonZeroI8">
|
||||
<DisplayString>{__0}</DisplayString>
|
||||
</Type>
|
||||
|
@ -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() {()}
|
||||
|
@ -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)]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user