diff --git a/tokio/src/task/task_local.rs b/tokio/src/task/task_local.rs index ba58ea6ae..cb9d22c61 100644 --- a/tokio/src/task/task_local.rs +++ b/tokio/src/task/task_local.rs @@ -264,16 +264,16 @@ impl LocalKey { } } -impl LocalKey { +impl LocalKey { /// Returns a copy of the task-local value - /// if the task-local value implements `Copy`. + /// if the task-local value implements `Clone`. /// /// # Panics /// /// This function will panic if the task local doesn't have a value set. #[track_caller] pub fn get(&'static self) -> T { - self.with(|v| *v) + self.with(|v| v.clone()) } }