From 5cdfc8cb7efc7ec3abfe9316fee8ee65b6f6f66b Mon Sep 17 00:00:00 2001 From: Sunli Date: Mon, 30 May 2022 18:43:35 +0800 Subject: [PATCH] feat(napi) implement `From` for `napi::Error` --- crates/napi/src/error.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/crates/napi/src/error.rs b/crates/napi/src/error.rs index c530e925..ec368b0a 100644 --- a/crates/napi/src/error.rs +++ b/crates/napi/src/error.rs @@ -34,6 +34,12 @@ unsafe impl Sync for Error {} impl error::Error for Error {} +impl From for Error { + fn from(_: std::convert::Infallible) -> Self { + unreachable!() + } +} + #[cfg(feature = "serde-json")] impl ser::Error for Error { fn custom(msg: T) -> Self {