Skip to content

Commit

Permalink
subscriber: remove Subscribe impls for Arcs
Browse files Browse the repository at this point in the history
Implementing `Subscribe` for `Arc`s, which are immutable, breaks the
ability to implement `Subscribe::on_layer` with a mutable reference.
This is necessary for per-layer filtering. See
#1576 (comment) for
details. Therefore, the `Layer` impls for `Arc`s should not be used.

In 0.3, we have the opportunity to remove these APIs. Therefore, this PR
removes them.
  • Loading branch information
hawkw committed Oct 19, 2021
1 parent 545fc18 commit 72abf1a
Showing 1 changed file with 1 addition and 16 deletions.
17 changes: 1 addition & 16 deletions tracing-subscriber/src/subscribe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use tracing_core::{

#[cfg(feature = "registry")]
use crate::registry::{self, LookupSpan, Registry, SpanRef};
use std::{any::TypeId, marker::PhantomData, ops::Deref, ptr::NonNull, sync::Arc};
use std::{any::TypeId, marker::PhantomData, ops::Deref, ptr::NonNull};

/// A composable handler for `tracing` events.
///
Expand Down Expand Up @@ -949,21 +949,6 @@ macro_rules! subscriber_impl_body {
};
}

impl<S, C> Subscribe<C> for Arc<S>
where
S: Subscribe<C>,
C: Collect,
{
subscriber_impl_body! {}
}

impl<C> Subscribe<C> for Arc<dyn Subscribe<C> + Send + Sync>
where
C: Collect,
{
subscriber_impl_body! {}
}

impl<S, C> Subscribe<C> for Box<S>
where
S: Subscribe<C>,
Expand Down

0 comments on commit 72abf1a

Please sign in to comment.