From b232b11ba522d8fb1484fdc925f64871d55d5a5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eduardo=20S=C3=A1nchez=20Mu=C3=B1oz?= Date: Wed, 13 Apr 2022 20:57:31 +0200 Subject: [PATCH] Fix debugger tests --- src/etc/gdb_providers.py | 4 +++- src/etc/lldb_providers.py | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/etc/gdb_providers.py b/src/etc/gdb_providers.py index 33d26db547e..0a52b8c976f 100644 --- a/src/etc/gdb_providers.py +++ b/src/etc/gdb_providers.py @@ -12,8 +12,10 @@ FIRST_FIELD = "__1" def unwrap_unique_or_non_null(unique_or_nonnull): # BACKCOMPAT: rust 1.32 # https://github.com/rust-lang/rust/commit/7a0911528058e87d22ea305695f4047572c5e067 + # BACKCOMPAT: rust 1.60 + # https://github.com/rust-lang/rust/commit/2a91eeac1a2d27dd3de1bf55515d765da20fd86f ptr = unique_or_nonnull["pointer"] - return ptr if ptr.type.code == gdb.TYPE_CODE_PTR else ptr[ZERO_FIELD] + return ptr if ptr.type.code == gdb.TYPE_CODE_PTR else ptr[ptr.type.fields()[0]] class EnumProvider: diff --git a/src/etc/lldb_providers.py b/src/etc/lldb_providers.py index 86dcc335e3c..35ac07f0db7 100644 --- a/src/etc/lldb_providers.py +++ b/src/etc/lldb_providers.py @@ -63,6 +63,8 @@ class ValueBuilder: def unwrap_unique_or_non_null(unique_or_nonnull): # BACKCOMPAT: rust 1.32 # https://github.com/rust-lang/rust/commit/7a0911528058e87d22ea305695f4047572c5e067 + # BACKCOMPAT: rust 1.60 + # https://github.com/rust-lang/rust/commit/2a91eeac1a2d27dd3de1bf55515d765da20fd86f ptr = unique_or_nonnull.GetChildMemberWithName("pointer") return ptr if ptr.TypeIsPointerType() else ptr.GetChildAtIndex(0) @@ -268,7 +270,9 @@ class StdVecSyntheticProvider: struct RawVec { ptr: Unique, cap: usize, ... } rust 1.31.1: struct Unique { pointer: NonZero<*const T>, ... } rust 1.33.0: struct Unique { pointer: *const T, ... } + rust 1.62.0: struct Unique { pointer: NonNull, ... } struct NonZero(T) + struct NonNull { pointer: *const T } """ def __init__(self, valobj, dict):