Skip to content

Commit 003a89f

Browse files
authored
Merge pull request #326 from dtolnay/sealed
Seal the private AsDisplay trait
2 parents 5088592 + 010c2d8 commit 003a89f

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/display.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use core::fmt::Display;
22
use std::path::{self, Path, PathBuf};
33

44
#[doc(hidden)]
5-
pub trait AsDisplay<'a> {
5+
pub trait AsDisplay<'a>: Sealed {
66
// TODO: convert to generic associated type.
77
// https://github.com/dtolnay/thiserror/pull/253
88
type Target: Display;
@@ -38,3 +38,9 @@ impl<'a> AsDisplay<'a> for PathBuf {
3838
self.display()
3939
}
4040
}
41+
42+
#[doc(hidden)]
43+
pub trait Sealed {}
44+
impl<T: Display> Sealed for &T {}
45+
impl Sealed for Path {}
46+
impl Sealed for PathBuf {}

0 commit comments

Comments
 (0)