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)]