diff --git a/tracing-subscriber/src/registry/mod.rs b/tracing-subscriber/src/registry/mod.rs index fcd0744a53..6cac0918ec 100644 --- a/tracing-subscriber/src/registry/mod.rs +++ b/tracing-subscriber/src/registry/mod.rs @@ -187,8 +187,12 @@ where /// Flips the order of the iterator, so that it is ordered from root to leaf. #[allow(clippy::wrong_self_convention)] pub fn from_root(self) -> SpanScopeFromRoot<'a, R> { + #[cfg(feature = "smallvec")] + type Buf = smallvec::SmallVec; + #[cfg(not(feature = "smallvec"))] + type Buf = Vec; SpanScopeFromRoot { - spans: self.collect::>().into_iter().rev(), + spans: self.collect::>().into_iter().rev(), } } } @@ -213,6 +217,9 @@ pub struct SpanScopeFromRoot<'a, R> where R: LookupSpan<'a>, { + #[cfg(feature = "smallvec")] + spans: std::iter::Rev>>, + #[cfg(not(feature = "smallvec"))] spans: std::iter::Rev>>, }