fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
7.8 KiB190 linesraw
1<?xml version="1.0" encoding="utf-8"?>
2<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
3  <Type Name="alloc::vec::Vec&lt;*&gt;">
4    <DisplayString>{{ len={len} }}</DisplayString>
5    <Expand>
6      <Item Name="[len]" ExcludeView="simple">len</Item>
7      <Item Name="[capacity]" ExcludeView="simple">buf.cap</Item>
8      <ArrayItems>
9        <Size>len</Size>
10        <ValuePointer>buf.ptr.pointer.pointer</ValuePointer>
11      </ArrayItems>
12    </Expand>
13  </Type>
14  <Type Name="alloc::collections::vec_deque::VecDeque&lt;*&gt;">
15    <DisplayString>{{ len={len} }}</DisplayString>
16    <Expand>
17      <Item Name="[len]" ExcludeView="simple">len</Item>
18      <Item Name="[capacity]" ExcludeView="simple">buf.cap</Item>
19      <CustomListItems>
20        <Variable Name="i" InitialValue="0" />
21        <Size>len</Size>
22        <Loop>
23          <If Condition="i == len">
24            <Break/>
25          </If>
26          <Item>buf.ptr.pointer.pointer[(i + head) % buf.cap]</Item>
27          <Exec>i = i + 1</Exec>
28        </Loop>
29      </CustomListItems>
30    </Expand>
31  </Type>
32  <Type Name="alloc::collections::linked_list::LinkedList&lt;*&gt;">
33    <DisplayString>{{ len={len} }}</DisplayString>
34    <Expand>
35      <LinkedListItems>
36        <Size>len</Size>
37        <HeadPointer>*(alloc::collections::linked_list::Node&lt;$T1&gt; **)&amp;head</HeadPointer>
38        <NextPointer>*(alloc::collections::linked_list::Node&lt;$T1&gt; **)&amp;next</NextPointer>
39        <ValueNode>element</ValueNode>
40      </LinkedListItems>
41    </Expand>
42  </Type>
43  <Type Name="alloc::string::String">
44    <DisplayString>{(char*)vec.buf.ptr.pointer.pointer,[vec.len]s8}</DisplayString>
45    <StringView>(char*)vec.buf.ptr.pointer.pointer,[vec.len]s8</StringView>
46    <Expand>
47      <Item Name="[len]" ExcludeView="simple">vec.len</Item>
48      <Item Name="[capacity]" ExcludeView="simple">vec.buf.cap</Item>
49      <Synthetic Name="[chars]">
50        <DisplayString>{(char*)vec.buf.ptr.pointer.pointer,[vec.len]s8}</DisplayString>
51        <Expand>
52          <ArrayItems>
53            <Size>vec.len</Size>
54            <ValuePointer>(char*)vec.buf.ptr.pointer.pointer</ValuePointer>
55          </ArrayItems>
56        </Expand>
57      </Synthetic>
58    </Expand>
59  </Type>
60
61  <!--
62      The display string for Rc, Arc, etc is optional because the expression cannot be evaluated
63      if the pointee is unsized (i.e. if `ptr.pointer` is a fat pointer).
64
65      There are also two versions for the reference count fields, one for sized and one for
66      dyn pointees.
67
68      Rc<[T]> and Arc<[T]> are handled separately altogether so we can actually show
69      the slice values. These visualizers have a second wildcard `foo&lt;slice2$&lt;*&gt;, *&gt;`
70      which accounts for the allocator parameter. This isn't needed for the other visualizers since
71      their inner `*` eats the type parameter but since the slice ones match part of the type params
72      it is necessary for them.
73  -->
74  <!-- alloc::rc::Rc<T> -->
75  <Type Name="alloc::rc::Rc&lt;*&gt;">
76    <DisplayString Optional="true">{ptr.pointer->value}</DisplayString>
77    <Expand>
78      <!-- thin -->
79      <ExpandedItem Optional="true">ptr.pointer->value</ExpandedItem>
80      <Item Name="[Reference count]" Optional="true">ptr.pointer->strong</Item>
81      <Item Name="[Weak reference count]" Optional="true">ptr.pointer->weak</Item>
82
83      <!-- dyn -->
84      <Item Name="[Reference count]" Optional="true">ptr.pointer.pointer->strong</Item>
85      <Item Name="[Weak reference count]" Optional="true">ptr.pointer.pointer->weak</Item>
86    </Expand>
87  </Type>
88
89  <!-- alloc::rc::Rc<[T]> -->
90  <Type Name="alloc::rc::Rc&lt;slice2$&lt;*&gt;,*&gt;">
91    <DisplayString>{{ len={ptr.pointer.length} }}</DisplayString>
92    <Expand>
93      <Item Name="[Length]" ExcludeView="simple">ptr.pointer.length</Item>
94      <Item Name="[Reference count]">ptr.pointer.data_ptr->strong</Item>
95      <Item Name="[Weak reference count]">ptr.pointer.data_ptr->weak</Item>
96      <ArrayItems>
97        <Size>ptr.pointer.length</Size>
98        <!-- We add +2 to the data_ptr in order to skip the ref count fields in the RcBox -->
99        <ValuePointer>($T1*)(((size_t*)ptr.pointer.data_ptr) + 2)</ValuePointer>
100      </ArrayItems>
101    </Expand>
102  </Type>
103
104  <!-- alloc::rc::Weak<T> -->
105  <Type Name="alloc::rc::Weak&lt;*&gt;">
106    <DisplayString Optional="true">{ptr.pointer->value}</DisplayString>
107    <Expand>
108      <!-- thin -->
109      <ExpandedItem Optional="true">ptr.pointer->value</ExpandedItem>
110      <Item Name="[Reference count]" Optional="true">ptr.pointer->strong</Item>
111      <Item Name="[Weak reference count]" Optional="true">ptr.pointer->weak</Item>
112
113      <!-- dyn -->
114      <Item Name="[Reference count]" Optional="true">ptr.pointer.pointer->strong</Item>
115      <Item Name="[Weak reference count]" Optional="true">ptr.pointer.pointer->weak</Item>
116    </Expand>
117  </Type>
118
119  <!-- alloc::rc::Weak<[T]> -->
120  <Type Name="alloc::rc::Weak&lt;slice2$&lt;*&gt;,*&gt;">
121    <DisplayString>{{ len={ptr.pointer.length} }}</DisplayString>
122    <Expand>
123      <Item Name="[Length]" ExcludeView="simple">ptr.pointer.length</Item>
124      <Item Name="[Reference count]">ptr.pointer.data_ptr->strong</Item>
125      <Item Name="[Weak reference count]">ptr.pointer.data_ptr->weak</Item>
126      <ArrayItems>
127        <Size>ptr.pointer.length</Size>
128        <ValuePointer>($T1*)(((size_t*)ptr.pointer.data_ptr) + 2)</ValuePointer>
129      </ArrayItems>
130    </Expand>
131  </Type>
132
133  <!-- alloc::sync::Arc<T> -->
134  <Type Name="alloc::sync::Arc&lt;*&gt;">
135    <DisplayString Optional="true">{ptr.pointer->data}</DisplayString>
136    <Expand>
137      <!-- thin -->
138      <ExpandedItem Optional="true">ptr.pointer->data</ExpandedItem>
139      <Item Name="[Reference count]" Optional="true">ptr.pointer->strong</Item>
140      <Item Name="[Weak reference count]" Optional="true">ptr.pointer->weak</Item>
141
142      <!-- dyn -->
143      <Item Name="[Reference count]" Optional="true">ptr.pointer.pointer->strong</Item>
144      <Item Name="[Weak reference count]" Optional="true">ptr.pointer.pointer->weak</Item>
145    </Expand>
146  </Type>
147
148  <!-- alloc::sync::Arc<[T]> -->
149  <Type Name="alloc::sync::Arc&lt;slice2$&lt;*&gt;,*&gt;">
150    <DisplayString>{{ len={ptr.pointer.length} }}</DisplayString>
151    <Expand>
152      <Item Name="[Length]" ExcludeView="simple">ptr.pointer.length</Item>
153      <Item Name="[Reference count]">ptr.pointer.data_ptr->strong</Item>
154      <Item Name="[Weak reference count]">ptr.pointer.data_ptr->weak</Item>
155      <ArrayItems>
156        <Size>ptr.pointer.length</Size>
157        <ValuePointer>($T1*)(((size_t*)ptr.pointer.data_ptr) + 2)</ValuePointer>
158      </ArrayItems>
159    </Expand>
160  </Type>
161
162  <!-- alloc::sync::Weak<T> -->
163  <Type Name="alloc::sync::Weak&lt;*&gt;">
164    <DisplayString Optional="true">{ptr.pointer->data}</DisplayString>
165    <Expand>
166      <!-- thin -->
167      <ExpandedItem Optional="true">ptr.pointer->data</ExpandedItem>
168      <Item Name="[Reference count]" Optional="true">ptr.pointer->strong</Item>
169      <Item Name="[Weak reference count]" Optional="true">ptr.pointer->weak</Item>
170
171      <!-- dyn -->
172      <Item Name="[Reference count]" Optional="true">ptr.pointer.pointer->strong</Item>
173      <Item Name="[Weak reference count]" Optional="true">ptr.pointer.pointer->weak</Item>
174    </Expand>
175  </Type>
176
177  <!-- alloc::sync::Weak<[T]> -->
178  <Type Name="alloc::sync::Weak&lt;slice2$&lt;*&gt;,*&gt;">
179    <DisplayString>{{ len={ptr.pointer.length} }}</DisplayString>
180    <Expand>
181      <Item Name="[Length]" ExcludeView="simple">ptr.pointer.length</Item>
182      <Item Name="[Reference count]">ptr.pointer.data_ptr->strong</Item>
183      <Item Name="[Weak reference count]">ptr.pointer.data_ptr->weak</Item>
184      <ArrayItems>
185        <Size>ptr.pointer.length</Size>
186        <ValuePointer>($T1*)(((size_t*)ptr.pointer.data_ptr) + 2)</ValuePointer>
187      </ArrayItems>
188    </Expand>
189  </Type>
190</AutoVisualizer>