Skip to content

Commit

Permalink
seal the Diagnose trait (#107)
Browse files Browse the repository at this point in the history
* seal the `Diagnose` trait
  • Loading branch information
asmello authored Feb 25, 2025
1 parent 0abe6e5 commit a543dc8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## Unreleased

### Changed

- Sealed the `Diagnose` trait.
- Implementation of the `Default` trait for `Pointer` now doesn't constrain the lifetime.

## [0.7.1] 2025-02-16
Expand Down
7 changes: 6 additions & 1 deletion src/diagnostic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<E>`](`Report`), yielding
/// `Result<_, Report<E>>`.
pub trait Diagnose<'s, T> {
pub trait Diagnose<'s, T>: private::Sealed {
/// The error type returned from `diagnose` and `diagnose_with`.
type Error: Diagnostic;

Expand Down Expand Up @@ -224,6 +224,11 @@ where
}
}

mod private {
pub trait Sealed {}
impl<T, E> Sealed for Result<T, E> {}
}

#[cfg(test)]
mod tests {
use super::*;
Expand Down

0 comments on commit a543dc8

Please sign in to comment.