Skip to content

Commit f2aba34

Browse files
committed
Add natvis for Range types
1 parent 8f1eec3 commit f2aba34

File tree

2 files changed

+35
-17
lines changed

2 files changed

+35
-17
lines changed

src/etc/natvis/libcore.natvis

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,22 @@
7575
<DisplayString>{__0}</DisplayString>
7676
</Type>
7777

78+
<Type Name="core::ops::range::Range&lt;*&gt;">
79+
<DisplayString>({start}..{end})</DisplayString>
80+
</Type>
81+
<Type Name="core::ops::range::RangeFrom&lt;*&gt;">
82+
<DisplayString>({start}..)</DisplayString>
83+
</Type>
84+
<Type Name="core::ops::range::RangeInclusive&lt;*&gt;">
85+
<DisplayString>({start}..={end})</DisplayString>
86+
</Type>
87+
<Type Name="core::ops::range::RangeTo&lt;*&gt;">
88+
<DisplayString>(..{end})</DisplayString>
89+
</Type>
90+
<Type Name="core::ops::range::RangeToInclusive&lt;*&gt;">
91+
<DisplayString>(..={end})</DisplayString>
92+
</Type>
93+
7894
<Type Name="core::ptr::non_null::NonNull&lt;*&gt;">
7995
<DisplayString>NonNull({(void*) pointer}: {pointer})</DisplayString>
8096
<Expand>

src/test/debuginfo/range-types.rs

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,38 +9,40 @@
99
// cdb-command: g
1010

1111
// cdb-command: dx r1,d
12-
// cdb-check:r1,d [Type: core::ops::range::Range<i32>]
13-
// cdb-check: [...] start : 3 [Type: int]
14-
// cdb-check: [...] end : 5 [Type: int]
12+
// cdb-check:r1,d : (3..5) [Type: core::ops::range::Range<i32>]
13+
// cdb-check: [<Raw View>] [Type: core::ops::range::Range<i32>]
1514

1615
// cdb-command: dx r2,d
17-
// cdb-check:r2,d [Type: core::ops::range::RangeFrom<i32>]
18-
// cdb-check: [...] start : 2 [Type: int]
16+
// cdb-check:r2,d : (2..) [Type: core::ops::range::RangeFrom<i32>]
17+
// cdb-check: [<Raw View>] [Type: core::ops::range::RangeFrom<i32>]
1918

2019
// cdb-command: dx r3,d
21-
// cdb-check:r3,d [Type: core::ops::range::RangeInclusive<i32>]
22-
// cdb-check: [...] start : 1 [Type: int]
23-
// cdb-check: [...] end : 4 [Type: int]
24-
// cdb-check: [...] exhausted : false [Type: bool]
20+
// cdb-check:r3,d : (1..=4) [Type: core::ops::range::RangeInclusive<i32>]
21+
// cdb-check: [<Raw View>] [Type: core::ops::range::RangeInclusive<i32>]
2522

2623
// cdb-command: dx r4,d
27-
// cdb-check:r4,d [Type: core::ops::range::RangeToInclusive<i32>]
28-
// cdb-check: [...] end : 3 [Type: int]
24+
// cdb-check:r4,d : (..10) [Type: core::ops::range::RangeTo<i32>]
25+
// cdb-check: [<Raw View>] [Type: core::ops::range::RangeTo<i32>]
2926

3027
// cdb-command: dx r5,d
31-
// cdb-check:r5,d [Type: core::ops::range::RangeFull]
28+
// cdb-check:r5,d : (..=3) [Type: core::ops::range::RangeToInclusive<i32>]
29+
// cdb-check: [<Raw View>] [Type: core::ops::range::RangeToInclusive<i32>]
30+
31+
// cdb-command: dx r6,d
32+
// cdb-check:r6,d [Type: core::ops::range::RangeFull]
3233

3334
#[allow(unused_variables)]
3435

3536
use std::ops::{Range, RangeFrom, RangeFull, RangeInclusive, RangeToInclusive};
3637

3738
fn main()
3839
{
39-
let r1 = Range{start: 3, end: 5};
40-
let r2 = RangeFrom{start: 2};
41-
let r3 = RangeInclusive::new(1, 4);
42-
let r4 = RangeToInclusive{end: 3};
43-
let r5 = RangeFull{};
40+
let r1 = (3..5);
41+
let r2 = (2..);
42+
let r3 = (1..=4);
43+
let r4 = (..10);
44+
let r5 = (..=3);
45+
let r6 = (..);
4446
zzz(); // #break
4547
}
4648

0 commit comments

Comments
 (0)