From 72abf1a977c93cc5f82e75eb0d47bee10a7ce16c Mon Sep 17 00:00:00 2001 From: Eliza Weisman Date: Tue, 19 Oct 2021 10:13:28 -0700 Subject: [PATCH] subscriber: remove `Subscribe` impls for `Arc`s 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 https://github.com/tokio-rs/tracing/pull/1576#discussion_r711609810 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. --- tracing-subscriber/src/subscribe.rs | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/tracing-subscriber/src/subscribe.rs b/tracing-subscriber/src/subscribe.rs index a195ba6b51..6c9673dad4 100644 --- a/tracing-subscriber/src/subscribe.rs +++ b/tracing-subscriber/src/subscribe.rs @@ -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. /// @@ -949,21 +949,6 @@ macro_rules! subscriber_impl_body { }; } -impl Subscribe for Arc -where - S: Subscribe, - C: Collect, -{ - subscriber_impl_body! {} -} - -impl Subscribe for Arc + Send + Sync> -where - C: Collect, -{ - subscriber_impl_body! {} -} - impl Subscribe for Box where S: Subscribe,