Skip to content

Commit 691ee05

Browse files
committed
Add natvis for Duration, ManuallyDrop and Pin types
1 parent f2aba34 commit 691ee05

File tree

3 files changed

+62
-0
lines changed

3 files changed

+62
-0
lines changed

src/etc/natvis/libcore.natvis

+22
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,13 @@
3434
</Expand>
3535
</Type>
3636

37+
<Type Name="core::mem::manually_drop::ManuallyDrop&lt;*&gt;">
38+
<DisplayString>{value}</DisplayString>
39+
<Expand>
40+
<ExpandedItem>value</ExpandedItem>
41+
</Expand>
42+
</Type>
43+
3744
<Type Name="core::num::nonzero::NonZeroI8">
3845
<DisplayString>{__0}</DisplayString>
3946
</Type>
@@ -91,6 +98,13 @@
9198
<DisplayString>(..={end})</DisplayString>
9299
</Type>
93100

101+
<Type Name="core::pin::Pin&lt;*&gt;">
102+
<DisplayString>Pin({(void*)pointer}: {pointer})</DisplayString>
103+
<Expand>
104+
<ExpandedItem>pointer</ExpandedItem>
105+
</Expand>
106+
</Type>
107+
94108
<Type Name="core::ptr::non_null::NonNull&lt;*&gt;">
95109
<DisplayString>NonNull({(void*) pointer}: {pointer})</DisplayString>
96110
<Expand>
@@ -138,4 +152,12 @@
138152
<Type Name="core::sync::atomic::AtomicUsize">
139153
<DisplayString>{v.value}</DisplayString>
140154
</Type>
155+
156+
<Type Name="core::time::Duration">
157+
<DisplayString>{secs,d}s {nanos,d}ns</DisplayString>
158+
<Expand>
159+
<Item Name="seconds">secs</Item>
160+
<Item Name="nanoseconds">nanos</Item>
161+
</Expand>
162+
</Type>
141163
</AutoVisualizer>

src/test/debuginfo/duration-type.rs

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// only-cdb
2+
// compile-flags:-g
3+
4+
// === CDB TESTS ==================================================================================
5+
6+
// cdb-command: g
7+
8+
// cdb-command: dx duration
9+
// cdb-check:duration : 5s 12ns [Type: core::time::Duration]
10+
// cdb-check: [<Raw View>] [Type: core::time::Duration]
11+
// cdb-check: seconds : 0x5 [Type: unsigned __int64]
12+
// cdb-check: nanoseconds : 0xc [Type: unsigned int]
13+
14+
use std::time::Duration;
15+
16+
fn main() {
17+
let duration = Duration::new(5, 12);
18+
19+
zzz(); // #break
20+
}
21+
22+
fn zzz() { }

src/test/debuginfo/marker-types.rs

+18
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,29 @@
1010
// cdb-check: [<Raw View>] [Type: core::ptr::non_null::NonNull<u32>]
1111
// cdb-checK: 0xc [Type: unsigned int]
1212

13+
// cdb-command: dx manuallydrop
14+
// cdb-check:manuallydrop : 12345 [Type: core::mem::manually_drop::ManuallyDrop<i32>]
15+
// cdb-check: [<Raw View>] [Type: core::mem::manually_drop::ManuallyDrop<i32>]
16+
17+
// cdb-command: dx pin
18+
// cdb-check:pin : Pin(0x[...]: "this") [Type: core::pin::Pin<ref_mut$<alloc::string::String> >]
19+
// cdb-check: [<Raw View>] [Type: core::pin::Pin<ref_mut$<alloc::string::String> >]
20+
// cdb-check: [len] : 0x4 [Type: unsigned __int64]
21+
// cdb-check: [capacity] : 0x4 [Type: unsigned __int64]
22+
// cdb-check: [chars]
23+
24+
use std::mem::ManuallyDrop;
25+
use std::pin::Pin;
1326
use std::ptr::NonNull;
1427

1528
fn main() {
1629
let nonnull: NonNull<_> = (&12u32).into();
1730

31+
let manuallydrop = ManuallyDrop::new(12345i32);
32+
33+
let mut s = "this".to_string();
34+
let pin = Pin::new(&mut s);
35+
1836
zzz(); // #break
1937
}
2038

0 commit comments

Comments
 (0)