From 6916c1e05d26f54664c67f6d2e3ddb72ad7eb18e Mon Sep 17 00:00:00 2001 From: Pierre Chevalier Date: Thu, 27 Dec 2018 14:41:19 +0000 Subject: [PATCH] (fix) Fix compiler error with rust 1.31.1 Refering to Self in where clause became illegal because: > As was discovered in #50781 a combination of implementing a trait > directly for a dyn type and where clauses involving Self can punch a > hole in our dyn-capability rules. See this issue for details: https://github.com/rust-lang/rust/issues/51443 --- src/internals.rs | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/internals.rs b/src/internals.rs index f88d5bf..81ef9c5 100644 --- a/src/internals.rs +++ b/src/internals.rs @@ -26,30 +26,29 @@ unsafe impl UnsafeAnyExt for DebugAny + Send + Sync {} /// additional bounds. /// /// There is also an exported alias for this type of `TypeMap`, `CloneAny`. -pub trait CloneAny: Any { +pub trait CloneAny: Any + Send + Sync { #[doc(hidden)] fn clone_any(&self) -> Box; #[doc(hidden)] - fn clone_any_send(&self) -> Box where Self: Send; + fn clone_any_send(&self) -> Box; #[doc(hidden)] - fn clone_any_sync(&self) -> Box where Self: Sync; + fn clone_any_sync(&self) -> Box; #[doc(hidden)] - fn clone_any_send_sync(&self) -> Box where Self: Send + Sync; + fn clone_any_send_sync(&self) -> Box; } -impl CloneAny for T { +impl CloneAny for T { fn clone_any(&self) -> Box { Box::new(self.clone()) } - fn clone_any_send(&self) -> Box where Self: Send { + fn clone_any_send(&self) -> Box { Box::new(self.clone()) } - fn clone_any_sync(&self) -> Box where Self: Sync { + fn clone_any_sync(&self) -> Box { Box::new(self.clone()) } - fn clone_any_send_sync(&self) -> Box - where Self: Send + Sync { + fn clone_any_send_sync(&self) -> Box { Box::new(self.clone()) } }