From cf1079229ef4647a17b1c9a51b091a249ce2a444 Mon Sep 17 00:00:00 2001 From: Arlie Davis Date: Wed, 26 Jun 2024 09:51:02 -0700 Subject: [PATCH] fix dead code warning in ComPtr, update natvis --- crates/libs/result/.natvis | 13 +++++++++---- crates/libs/result/src/error.rs | 8 ++++++-- crates/libs/result/src/lib.rs | 2 +- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/crates/libs/result/.natvis b/crates/libs/result/.natvis index cc5da51de3..036d0c86de 100644 --- a/crates/libs/result/.natvis +++ b/crates/libs/result/.natvis @@ -1,17 +1,22 @@  + {(HRESULT)code.__0.__0} code - detail + (HRESULT)code.__0.__0 + info - {(::HRESULT)__0} + {(HRESULT)__0} - - {(::HRESULT)__0.__0.__0} + + ErrorInfo + + *(void**)&ptr + diff --git a/crates/libs/result/src/error.rs b/crates/libs/result/src/error.rs index 04a9f9b3ad..645c7284c5 100644 --- a/crates/libs/result/src/error.rs +++ b/crates/libs/result/src/error.rs @@ -354,10 +354,14 @@ mod error_info { mod error_info { use super::*; + // We use this name so that the NatVis element for ErrorInfo does *not* match this type. + // This prevents the NatVis description from failing to load. #[derive(Clone, Default)] - pub(crate) struct ErrorInfo; + pub(crate) struct EmptyErrorInfo; - impl ErrorInfo { + pub(crate) use EmptyErrorInfo as ErrorInfo; + + impl EmptyErrorInfo { pub(crate) const fn empty() -> Self { Self } diff --git a/crates/libs/result/src/lib.rs b/crates/libs/result/src/lib.rs index 30babbfb1e..95fcf98851 100644 --- a/crates/libs/result/src/lib.rs +++ b/crates/libs/result/src/lib.rs @@ -17,7 +17,7 @@ use alloc::{string::String, vec::Vec}; mod bindings; use bindings::*; -#[cfg(windows)] +#[cfg(all(windows, feature = "error-info", not(feature = "disable-error-info")))] mod com; #[cfg(windows)]