diff --git a/src/source_impls.rs b/src/source_impls.rs index 74101fa..8e5c8f7 100644 --- a/src/source_impls.rs +++ b/src/source_impls.rs @@ -1,7 +1,11 @@ /*! Default trait implementations for [Source]. */ -use std::{borrow::Cow, sync::Arc}; +use std::{ + borrow::{Cow, ToOwned}, + fmt::Debug, + sync::Arc, +}; use crate::{MietteError, MietteSpanContents, Source, SourceSpan, SpanContents}; @@ -84,7 +88,12 @@ impl Source for Arc { } } -impl Source for Cow<'_, T> { +impl Source for Cow<'_, T> +where + // The minimal bounds are used here. `T::Owned` need not be `Source`, because `&T` can always + // be obtained from `Cow<'_, T>`. + T::Owned: Debug + Send + Sync, +{ fn read_span<'a>( &'a self, span: &SourceSpan,