Skip to content

Commit 29c96a7

Browse files
committed
seal the Diagnose trait
1 parent cf16365 commit 29c96a7

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

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)