From b5f995544e0b1eca4683ef7c39542aa8ff54c52f Mon Sep 17 00:00:00 2001 From: ortem Date: Tue, 6 Apr 2021 00:49:56 +0300 Subject: [PATCH] Fix HashMap/HashSet LLDB pretty-printer on Rust <= 1.51 The pretty-printer was broken in https://github.com/rust-lang/rust/pull/77566 after updating to Rust 1.52. Now it is compatible with older Rust versions as well --- src/etc/lldb_providers.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/etc/lldb_providers.py b/src/etc/lldb_providers.py index 702f2e82e4e2c..f52965b04fc2b 100644 --- a/src/etc/lldb_providers.py +++ b/src/etc/lldb_providers.py @@ -563,7 +563,11 @@ def table(self): # HashSet wraps either std HashMap or hashbrown::HashSet, which both # wrap hashbrown::HashMap, so either way we "unwrap" twice. hashbrown_hashmap = self.valobj.GetChildAtIndex(0).GetChildAtIndex(0) - return hashbrown_hashmap.GetChildMemberWithName("table").GetChildMemberWithName("table") + table = hashbrown_hashmap.GetChildMemberWithName("table") + # BACKCOMPAT: rust 1.51. Drop this condition (https://github.com/rust-lang/rust/pull/77566) + if table.GetChildMemberWithName("table").IsValid(): + table = table.GetChildMemberWithName("table") + return table def has_children(self): # type: () -> bool