Skip to content

Commit

Permalink
fix msrv-related issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Arlie Davis committed Jun 25, 2024
1 parent db9c87d commit 4f3196a
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions crates/libs/result/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -267,11 +267,6 @@ impl<Detail: ErrorDetail> ErrorT<Detail> {
}
}

/// 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() {
Expand All @@ -288,6 +283,15 @@ impl<Detail: ErrorDetail> ErrorT<Detail> {
}
}

// 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<Detail> ErrorT<Detail> {
/// The error code describing the error.
pub const fn code(&self) -> HRESULT {
self.code.to_hresult()
}
}

#[cfg(feature = "std")]
impl<Detail: ErrorDetail> std::error::Error for ErrorT<Detail> {}

Expand Down

0 comments on commit 4f3196a

Please sign in to comment.