Skip to content

Commit

Permalink
Seal the Spanned trait
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Mar 12, 2023
1 parent 157a12b commit 182f6e8
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/spanned.rs
Expand Up @@ -93,7 +93,7 @@ use quote::spanned::Spanned as ToTokens;
/// See the [module documentation] for an example.
///
/// [module documentation]: self
pub trait Spanned {
pub trait Spanned: private::Sealed {
/// Returns a `Span` covering the complete contents of this syntax tree
/// node, or [`Span::call_site()`] if this node is empty.
///
Expand All @@ -106,3 +106,10 @@ impl<T: ?Sized + ToTokens> Spanned for T {
self.__span()
}
}

mod private {
use super::*;

pub trait Sealed {}
impl<T: ?Sized + ToTokens> Sealed for T {}
}

0 comments on commit 182f6e8

Please sign in to comment.