Skip to content

Commit a543dc8

Browse files
authored
seal the Diagnose trait (#107)
* seal the `Diagnose` trait
1 parent 0abe6e5 commit a543dc8

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88
## Unreleased
99

1010
### Changed
11-
11+
- Sealed the `Diagnose` trait.
1212
- Implementation of the `Default` trait for `Pointer` now doesn't constrain the lifetime.
1313

1414
## [0.7.1] 2025-02-16

src/diagnostic.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ pub(crate) use diagnostic_url;
163163
/// An extension trait for `Result<_, E>`, where `E` is an implementation of
164164
/// [`Diagnostic`], that converts `E` into [`Report<E>`](`Report`), yielding
165165
/// `Result<_, Report<E>>`.
166-
pub trait Diagnose<'s, T> {
166+
pub trait Diagnose<'s, T>: private::Sealed {
167167
/// The error type returned from `diagnose` and `diagnose_with`.
168168
type Error: Diagnostic;
169169

@@ -224,6 +224,11 @@ where
224224
}
225225
}
226226

227+
mod private {
228+
pub trait Sealed {}
229+
impl<T, E> Sealed for Result<T, E> {}
230+
}
231+
227232
#[cfg(test)]
228233
mod tests {
229234
use super::*;

0 commit comments

Comments
 (0)