Skip to content

Commit

Permalink
Merge pull request #326 from dtolnay/sealed
Browse files Browse the repository at this point in the history
Seal the private AsDisplay trait
  • Loading branch information
dtolnay authored Oct 25, 2024
2 parents 5088592 + 010c2d8 commit 003a89f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/display.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use core::fmt::Display;
use std::path::{self, Path, PathBuf};

#[doc(hidden)]
pub trait AsDisplay<'a> {
pub trait AsDisplay<'a>: Sealed {
// TODO: convert to generic associated type.
// https://github.com/dtolnay/thiserror/pull/253
type Target: Display;
Expand Down Expand Up @@ -38,3 +38,9 @@ impl<'a> AsDisplay<'a> for PathBuf {
self.display()
}
}

#[doc(hidden)]
pub trait Sealed {}
impl<T: Display> Sealed for &T {}
impl Sealed for Path {}
impl Sealed for PathBuf {}

0 comments on commit 003a89f

Please sign in to comment.