From 29c96a75e33e0a62f32c35c1ac9ead8778f26f31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20S=C3=A1=20de=20Mello?= Date: Mon, 17 Feb 2025 20:59:34 +0000 Subject: [PATCH 1/2] seal the `Diagnose` trait --- src/diagnostic.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/diagnostic.rs b/src/diagnostic.rs index 71d4643..d3e6943 100644 --- a/src/diagnostic.rs +++ b/src/diagnostic.rs @@ -163,7 +163,7 @@ pub(crate) use diagnostic_url; /// An extension trait for `Result<_, E>`, where `E` is an implementation of /// [`Diagnostic`], that converts `E` into [`Report`](`Report`), yielding /// `Result<_, Report>`. -pub trait Diagnose<'s, T> { +pub trait Diagnose<'s, T>: private::Sealed { /// The error type returned from `diagnose` and `diagnose_with`. type Error: Diagnostic; @@ -224,6 +224,11 @@ where } } +mod private { + pub trait Sealed {} + impl Sealed for Result {} +} + #[cfg(test)] mod tests { use super::*; From 726dc161e268713015e51214b9bd922d52951432 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20S=C3=A1=20de=20Mello?= Date: Sun, 23 Feb 2025 21:58:24 +0000 Subject: [PATCH 2/2] changelog --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 15dd2c6..c9c2aaa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## Unreleased + +### Fixed + +- Sealed the `Diagnose` trait. + ## [0.7.1] 2025-02-16 ### Changed