55
66
77# BACKCOMPAT: rust 1.35
8- def is_hashbrown_hashmap (hash_map ) :
8+ def is_hashbrown_hashmap (hash_map : lldb . SBValue ) -> bool :
99 return len (hash_map .type .fields ) == 1
1010
1111
12- def classify_rust_type (type ) :
12+ def classify_rust_type (type : lldb . SBType ) -> str :
1313 type_class = type .GetTypeClass ()
1414 if type_class == lldb .eTypeClassStruct :
1515 return classify_struct (type .name , type .fields )
@@ -19,106 +19,104 @@ def classify_rust_type(type):
1919 return RustType .OTHER
2020
2121
22- def summary_lookup (valobj , dict ):
23- # type: (SBValue, dict) -> str
22+ def summary_lookup (valobj : lldb .SBValue , _dict : LLDBOpaque ) -> str :
2423 """Returns the summary provider for the given value"""
2524 rust_type = classify_rust_type (valobj .GetType ())
2625
2726 if rust_type == RustType .STD_STRING :
28- return StdStringSummaryProvider (valobj , dict )
27+ return StdStringSummaryProvider (valobj , _dict )
2928 if rust_type == RustType .STD_OS_STRING :
30- return StdOsStringSummaryProvider (valobj , dict )
29+ return StdOsStringSummaryProvider (valobj , _dict )
3130 if rust_type == RustType .STD_STR :
32- return StdStrSummaryProvider (valobj , dict )
31+ return StdStrSummaryProvider (valobj , _dict )
3332
3433 if rust_type == RustType .STD_VEC :
35- return SizeSummaryProvider (valobj , dict )
34+ return SizeSummaryProvider (valobj , _dict )
3635 if rust_type == RustType .STD_VEC_DEQUE :
37- return SizeSummaryProvider (valobj , dict )
36+ return SizeSummaryProvider (valobj , _dict )
3837 if rust_type == RustType .STD_SLICE :
39- return SizeSummaryProvider (valobj , dict )
38+ return SizeSummaryProvider (valobj , _dict )
4039
4140 if rust_type == RustType .STD_HASH_MAP :
42- return SizeSummaryProvider (valobj , dict )
41+ return SizeSummaryProvider (valobj , _dict )
4342 if rust_type == RustType .STD_HASH_SET :
44- return SizeSummaryProvider (valobj , dict )
43+ return SizeSummaryProvider (valobj , _dict )
4544
4645 if rust_type == RustType .STD_RC :
47- return StdRcSummaryProvider (valobj , dict )
46+ return StdRcSummaryProvider (valobj , _dict )
4847 if rust_type == RustType .STD_ARC :
49- return StdRcSummaryProvider (valobj , dict )
48+ return StdRcSummaryProvider (valobj , _dict )
5049
5150 if rust_type == RustType .STD_REF :
52- return StdRefSummaryProvider (valobj , dict )
51+ return StdRefSummaryProvider (valobj , _dict )
5352 if rust_type == RustType .STD_REF_MUT :
54- return StdRefSummaryProvider (valobj , dict )
53+ return StdRefSummaryProvider (valobj , _dict )
5554 if rust_type == RustType .STD_REF_CELL :
56- return StdRefSummaryProvider (valobj , dict )
55+ return StdRefSummaryProvider (valobj , _dict )
5756
5857 if rust_type == RustType .STD_NONZERO_NUMBER :
59- return StdNonZeroNumberSummaryProvider (valobj , dict )
58+ return StdNonZeroNumberSummaryProvider (valobj , _dict )
6059
6160 if rust_type == RustType .STD_PATHBUF :
62- return StdPathBufSummaryProvider (valobj , dict )
61+ return StdPathBufSummaryProvider (valobj , _dict )
6362 if rust_type == RustType .STD_PATH :
64- return StdPathSummaryProvider (valobj , dict )
63+ return StdPathSummaryProvider (valobj , _dict )
6564
6665 return ""
6766
6867
69- def synthetic_lookup (valobj , dict ):
70- # type: (SBValue, dict) -> object
68+ def synthetic_lookup (valobj : lldb .SBValue , _dict : LLDBOpaque ) -> object :
7169 """Returns the synthetic provider for the given value"""
7270 rust_type = classify_rust_type (valobj .GetType ())
7371
7472 if rust_type == RustType .STRUCT :
75- return StructSyntheticProvider (valobj , dict )
73+ return StructSyntheticProvider (valobj , _dict )
7674 if rust_type == RustType .STRUCT_VARIANT :
77- return StructSyntheticProvider (valobj , dict , is_variant = True )
75+ return StructSyntheticProvider (valobj , _dict , is_variant = True )
7876 if rust_type == RustType .TUPLE :
79- return TupleSyntheticProvider (valobj , dict )
77+ return TupleSyntheticProvider (valobj , _dict )
8078 if rust_type == RustType .TUPLE_VARIANT :
81- return TupleSyntheticProvider (valobj , dict , is_variant = True )
79+ return TupleSyntheticProvider (valobj , _dict , is_variant = True )
8280 if rust_type == RustType .EMPTY :
83- return EmptySyntheticProvider (valobj , dict )
81+ return EmptySyntheticProvider (valobj , _dict )
8482 if rust_type == RustType .REGULAR_ENUM :
8583 discriminant = valobj .GetChildAtIndex (0 ).GetChildAtIndex (0 ).GetValueAsUnsigned ()
86- return synthetic_lookup (valobj .GetChildAtIndex (discriminant ), dict )
84+ return synthetic_lookup (valobj .GetChildAtIndex (discriminant ), _dict )
8785 if rust_type == RustType .SINGLETON_ENUM :
88- return synthetic_lookup (valobj .GetChildAtIndex (0 ), dict )
86+ return synthetic_lookup (valobj .GetChildAtIndex (0 ), _dict )
8987 if rust_type == RustType .ENUM :
90- return ClangEncodedEnumProvider (valobj , dict )
88+ return ClangEncodedEnumProvider (valobj , _dict )
9189 if rust_type == RustType .STD_VEC :
92- return StdVecSyntheticProvider (valobj , dict )
90+ return StdVecSyntheticProvider (valobj , _dict )
9391 if rust_type == RustType .STD_VEC_DEQUE :
94- return StdVecDequeSyntheticProvider (valobj , dict )
92+ return StdVecDequeSyntheticProvider (valobj , _dict )
9593 if rust_type == RustType .STD_SLICE or rust_type == RustType .STD_STR :
96- return StdSliceSyntheticProvider (valobj , dict )
94+ return StdSliceSyntheticProvider (valobj , _dict )
9795
9896 if rust_type == RustType .STD_HASH_MAP :
9997 if is_hashbrown_hashmap (valobj ):
100- return StdHashMapSyntheticProvider (valobj , dict )
98+ return StdHashMapSyntheticProvider (valobj , _dict )
10199 else :
102- return StdOldHashMapSyntheticProvider (valobj , dict )
100+ return StdOldHashMapSyntheticProvider (valobj , _dict )
103101 if rust_type == RustType .STD_HASH_SET :
104102 hash_map = valobj .GetChildAtIndex (0 )
105103 if is_hashbrown_hashmap (hash_map ):
106- return StdHashMapSyntheticProvider (valobj , dict , show_values = False )
104+ return StdHashMapSyntheticProvider (valobj , _dict , show_values = False )
107105 else :
108- return StdOldHashMapSyntheticProvider (hash_map , dict , show_values = False )
106+ return StdOldHashMapSyntheticProvider (hash_map , _dict , show_values = False )
109107
110108 if rust_type == RustType .STD_RC :
111- return StdRcSyntheticProvider (valobj , dict )
109+ return StdRcSyntheticProvider (valobj , _dict )
112110 if rust_type == RustType .STD_ARC :
113- return StdRcSyntheticProvider (valobj , dict , is_atomic = True )
111+ return StdRcSyntheticProvider (valobj , _dict , is_atomic = True )
114112
115113 if rust_type == RustType .STD_CELL :
116- return StdCellSyntheticProvider (valobj , dict )
114+ return StdCellSyntheticProvider (valobj , _dict )
117115 if rust_type == RustType .STD_REF :
118- return StdRefSyntheticProvider (valobj , dict )
116+ return StdRefSyntheticProvider (valobj , _dict )
119117 if rust_type == RustType .STD_REF_MUT :
120- return StdRefSyntheticProvider (valobj , dict )
118+ return StdRefSyntheticProvider (valobj , _dict )
121119 if rust_type == RustType .STD_REF_CELL :
122- return StdRefSyntheticProvider (valobj , dict , is_cell = True )
120+ return StdRefSyntheticProvider (valobj , _dict , is_cell = True )
123121
124- return DefaultSyntheticProvider (valobj , dict )
122+ return DefaultSyntheticProvider (valobj , _dict )
0 commit comments