Skip to content

Commit 6916c1e

Browse files
(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: rust-lang/rust#51443
1 parent 9452d89 commit 6916c1e

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

src/internals.rs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,30 +26,29 @@ unsafe impl UnsafeAnyExt for DebugAny + Send + Sync {}
2626
/// additional bounds.
2727
///
2828
/// There is also an exported alias for this type of `TypeMap`, `CloneAny`.
29-
pub trait CloneAny: Any {
29+
pub trait CloneAny: Any + Send + Sync {
3030
#[doc(hidden)]
3131
fn clone_any(&self) -> Box<CloneAny>;
3232
#[doc(hidden)]
33-
fn clone_any_send(&self) -> Box<CloneAny + Send> where Self: Send;
33+
fn clone_any_send(&self) -> Box<CloneAny + Send>;
3434
#[doc(hidden)]
35-
fn clone_any_sync(&self) -> Box<CloneAny + Sync> where Self: Sync;
35+
fn clone_any_sync(&self) -> Box<CloneAny + Sync>;
3636
#[doc(hidden)]
37-
fn clone_any_send_sync(&self) -> Box<CloneAny + Send + Sync> where Self: Send + Sync;
37+
fn clone_any_send_sync(&self) -> Box<CloneAny + Send + Sync>;
3838
}
3939

40-
impl<T: Any + Clone> CloneAny for T {
40+
impl<T: Any + Clone + Send + Sync> CloneAny for T {
4141
fn clone_any(&self) -> Box<CloneAny> { Box::new(self.clone()) }
4242

43-
fn clone_any_send(&self) -> Box<CloneAny + Send> where Self: Send {
43+
fn clone_any_send(&self) -> Box<CloneAny + Send> {
4444
Box::new(self.clone())
4545
}
4646

47-
fn clone_any_sync(&self) -> Box<CloneAny + Sync> where Self: Sync {
47+
fn clone_any_sync(&self) -> Box<CloneAny + Sync> {
4848
Box::new(self.clone())
4949
}
5050

51-
fn clone_any_send_sync(&self) -> Box<CloneAny + Send + Sync>
52-
where Self: Send + Sync {
51+
fn clone_any_send_sync(&self) -> Box<CloneAny + Send + Sync> {
5352
Box::new(self.clone())
5453
}
5554
}

0 commit comments

Comments
 (0)