summaryrefslogtreecommitdiffstats
path: root/src/etc
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:18:21 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:18:21 +0000
commit4e8199b572f2035b7749cba276ece3a26630d23e (patch)
treef09feeed6a0fe39d027b1908aa63ea6b35e4b631 /src/etc
parentAdding upstream version 1.66.0+dfsg1. (diff)
downloadrustc-4e8199b572f2035b7749cba276ece3a26630d23e.tar.xz
rustc-4e8199b572f2035b7749cba276ece3a26630d23e.zip
Adding upstream version 1.67.1+dfsg1.upstream/1.67.1+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/etc')
-rw-r--r--src/etc/gdb_providers.py8
-rw-r--r--src/etc/lldb_providers.py12
-rw-r--r--src/etc/natvis/intrinsic.natvis12
-rw-r--r--src/etc/natvis/liballoc.natvis23
4 files changed, 27 insertions, 28 deletions
diff --git a/src/etc/gdb_providers.py b/src/etc/gdb_providers.py
index c351c3450..32b8d8e24 100644
--- a/src/etc/gdb_providers.py
+++ b/src/etc/gdb_providers.py
@@ -144,20 +144,16 @@ class StdVecDequeProvider:
def __init__(self, valobj):
self.valobj = valobj
self.head = int(valobj["head"])
- self.tail = int(valobj["tail"])
+ self.size = int(valobj["len"])
self.cap = int(valobj["buf"]["cap"])
self.data_ptr = unwrap_unique_or_non_null(valobj["buf"]["ptr"])
- if self.head >= self.tail:
- self.size = self.head - self.tail
- else:
- self.size = self.cap + self.head - self.tail
def to_string(self):
return "VecDeque(size={})".format(self.size)
def children(self):
return _enumerate_array_elements(
- (self.data_ptr + ((self.tail + index) % self.cap)) for index in xrange(self.size)
+ (self.data_ptr + ((self.head + index) % self.cap)) for index in xrange(self.size)
)
@staticmethod
diff --git a/src/etc/lldb_providers.py b/src/etc/lldb_providers.py
index 8a9927e7d..697ad4293 100644
--- a/src/etc/lldb_providers.py
+++ b/src/etc/lldb_providers.py
@@ -356,7 +356,7 @@ class StdSliceSyntheticProvider:
class StdVecDequeSyntheticProvider:
"""Pretty-printer for alloc::collections::vec_deque::VecDeque<T>
- struct VecDeque<T> { tail: usize, head: usize, buf: RawVec<T> }
+ struct VecDeque<T> { head: usize, len: usize, buf: RawVec<T> }
"""
def __init__(self, valobj, dict):
@@ -373,7 +373,7 @@ class StdVecDequeSyntheticProvider:
def get_child_index(self, name):
# type: (str) -> int
index = name.lstrip('[').rstrip(']')
- if index.isdigit() and self.tail <= index and (self.tail + index) % self.cap < self.head:
+ if index.isdigit() and int(index) < self.size:
return int(index)
else:
return -1
@@ -381,20 +381,16 @@ class StdVecDequeSyntheticProvider:
def get_child_at_index(self, index):
# type: (int) -> SBValue
start = self.data_ptr.GetValueAsUnsigned()
- address = start + ((index + self.tail) % self.cap) * self.element_type_size
+ address = start + ((index + self.head) % self.cap) * self.element_type_size
element = self.data_ptr.CreateValueFromAddress("[%s]" % index, address, self.element_type)
return element
def update(self):
# type: () -> None
self.head = self.valobj.GetChildMemberWithName("head").GetValueAsUnsigned()
- self.tail = self.valobj.GetChildMemberWithName("tail").GetValueAsUnsigned()
+ self.size = self.valobj.GetChildMemberWithName("len").GetValueAsUnsigned()
self.buf = self.valobj.GetChildMemberWithName("buf")
self.cap = self.buf.GetChildMemberWithName("cap").GetValueAsUnsigned()
- if self.head >= self.tail:
- self.size = self.head - self.tail
- else:
- self.size = self.cap + self.head - self.tail
self.data_ptr = unwrap_unique_or_non_null(self.buf.GetChildMemberWithName("ptr"))
diff --git a/src/etc/natvis/intrinsic.natvis b/src/etc/natvis/intrinsic.natvis
index 277e57aaf..8c16a562e 100644
--- a/src/etc/natvis/intrinsic.natvis
+++ b/src/etc/natvis/intrinsic.natvis
@@ -1,6 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
- <Type Name="str">
+ <Type Name="ref$&lt;str$&gt;">
+ <AlternativeType Name="ref_mut$&lt;str$&gt;" />
+ <AlternativeType Name="ptr_const$&lt;str$&gt;" />
+ <AlternativeType Name="ptr_mut$&lt;str$&gt;" />
+
<DisplayString>{(char*)data_ptr,[length]s8}</DisplayString>
<StringView>(char*)data_ptr,[length]s8</StringView>
<Expand>
@@ -15,7 +19,11 @@
</Synthetic>
</Expand>
</Type>
- <Type Name="slice$&lt;*&gt;">
+ <Type Name="ref$&lt;slice2$&lt;*&gt; &gt;">
+ <AlternativeType Name="ref_mut$&lt;slice2$&lt;*&gt; &gt;" />
+ <AlternativeType Name="ptr_const$&lt;slice2$&lt;*&gt; &gt;" />
+ <AlternativeType Name="ptr_mut$&lt;slice2$&lt;*&gt; &gt;" />
+
<DisplayString>{{ len={length} }}</DisplayString>
<Expand>
<Item Name="[len]" ExcludeView="simple">length</Item>
diff --git a/src/etc/natvis/liballoc.natvis b/src/etc/natvis/liballoc.natvis
index bf6c02b91..c4ad98ec1 100644
--- a/src/etc/natvis/liballoc.natvis
+++ b/src/etc/natvis/liballoc.natvis
@@ -12,20 +12,19 @@
</Expand>
</Type>
<Type Name="alloc::collections::vec_deque::VecDeque&lt;*&gt;">
- <DisplayString>{{ len={tail &lt;= head ? head - tail : buf.cap - tail + head} }}</DisplayString>
+ <DisplayString>{{ len={len} }}</DisplayString>
<Expand>
- <Item Name="[len]" ExcludeView="simple">tail &lt;= head ? head - tail : buf.cap - tail + head</Item>
+ <Item Name="[len]" ExcludeView="simple">len</Item>
<Item Name="[capacity]" ExcludeView="simple">buf.cap</Item>
<CustomListItems>
- <Variable Name="i" InitialValue="tail" />
-
- <Size>tail &lt;= head ? head - tail : buf.cap - tail + head</Size>
+ <Variable Name="i" InitialValue="0" />
+ <Size>len</Size>
<Loop>
- <If Condition="i == head">
+ <If Condition="i == len">
<Break/>
</If>
- <Item>buf.ptr.pointer.pointer[i]</Item>
- <Exec>i = (i + 1 == buf.cap ? 0 : i + 1)</Exec>
+ <Item>buf.ptr.pointer.pointer[(i + head) % buf.cap]</Item>
+ <Exec>i = i + 1</Exec>
</Loop>
</CustomListItems>
</Expand>
@@ -85,7 +84,7 @@
</Type>
<!-- alloc::rc::Rc<[T]> -->
- <Type Name="alloc::rc::Rc&lt;slice$&lt;*&gt; &gt;">
+ <Type Name="alloc::rc::Rc&lt;slice2$&lt;*&gt; &gt;">
<DisplayString>{{ len={ptr.pointer.length} }}</DisplayString>
<Expand>
<Item Name="[Length]" ExcludeView="simple">ptr.pointer.length</Item>
@@ -115,7 +114,7 @@
</Type>
<!-- alloc::rc::Weak<[T]> -->
- <Type Name="alloc::rc::Weak&lt;slice$&lt;*&gt; &gt;">
+ <Type Name="alloc::rc::Weak&lt;slice2$&lt;*&gt; &gt;">
<DisplayString>{{ len={ptr.pointer.length} }}</DisplayString>
<Expand>
<Item Name="[Length]" ExcludeView="simple">ptr.pointer.length</Item>
@@ -144,7 +143,7 @@
</Type>
<!-- alloc::sync::Arc<[T]> -->
- <Type Name="alloc::sync::Arc&lt;slice$&lt;*&gt; &gt;">
+ <Type Name="alloc::sync::Arc&lt;slice2$&lt;*&gt; &gt;">
<DisplayString>{{ len={ptr.pointer.length} }}</DisplayString>
<Expand>
<Item Name="[Length]" ExcludeView="simple">ptr.pointer.length</Item>
@@ -173,7 +172,7 @@
</Type>
<!-- alloc::sync::Weak<[T]> -->
- <Type Name="alloc::sync::Weak&lt;slice$&lt;*&gt; &gt;">
+ <Type Name="alloc::sync::Weak&lt;slice2$&lt;*&gt; &gt;">
<DisplayString>{{ len={ptr.pointer.length} }}</DisplayString>
<Expand>
<Item Name="[Length]" ExcludeView="simple">ptr.pointer.length</Item>