From 4f3196addcc9702e774e3e7455aad08ac3b039b8 Mon Sep 17 00:00:00 2001 From: Arlie Davis Date: Tue, 25 Jun 2024 16:15:32 -0700 Subject: [PATCH] fix msrv-related issue --- crates/libs/result/src/error.rs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/crates/libs/result/src/error.rs b/crates/libs/result/src/error.rs index ecc6373118..5560b927c9 100644 --- a/crates/libs/result/src/error.rs +++ b/crates/libs/result/src/error.rs @@ -267,11 +267,6 @@ impl ErrorT { } } - /// The error code describing the error. - pub const fn code(&self) -> HRESULT { - self.code.to_hresult() - } - /// The error message describing the error. pub fn message(&self) -> String { if let Some(message) = self.detail.message() { @@ -288,6 +283,15 @@ impl ErrorT { } } +// This is a separate impl block because Rust 1.60.0 (our MSRV) rejects const fns that have +// trait bounds on them, so we place it in a separate impl without any bounds. +impl ErrorT { + /// The error code describing the error. + pub const fn code(&self) -> HRESULT { + self.code.to_hresult() + } +} + #[cfg(feature = "std")] impl std::error::Error for ErrorT {}