Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Future compatibility warning ("CloneToAny" cannot be made into an object) #31

Closed
jonas-schievink opened this issue Sep 17, 2018 · 3 comments

Comments

@jonas-schievink
Copy link

Compiling anymap on the current nightly results in this warning: rust-lang/rust#51443

warning: the trait `any::CloneToAny` cannot be made into an object                                                                                                                
  --> src/any.rs:15:5                                                                                                                                                             
   |                                                                                                                                                                              
15 |     fn clone_to_any_send(&self) -> Box<CloneAny + Send> where Self: Send;                                                                                                    
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                    
   |                                                                                                                                                                              
   = note: #[warn(where_clauses_object_safety)] on by default                                                                                                                     
   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!                                              
   = note: for more information, see issue #51443 <https://github.com/rust-lang/rust/issues/51443>                                                                                
   = note: method `clone_to_any_send` references the `Self` type in where clauses                                                                                                 

(same warning for all clone_to_any_X methods)

@chris-morgan
Copy link
Owner

I’ve assessed the situation in some detail in rust-lang/rust#51443 (comment). For now, I’m going to do nothing and see if I get any responses there.

What it’s doing should be absolutely fine, and if you don’t do Box<CloneAny + …> then you’re definitely fine.

@jonas-schievink
Copy link
Author

Yeah that seems fine, thanks! FWIW the typemap crate is also affected and has a very unsafe fix here: reem/rust-typemap#41

@chris-morgan
Copy link
Owner

Well, although it’s acknowledged to be a spurious warning, nothing’s been done about it, so I’ve finally caved and implemented it a different way, adding some more unsafe, but avoiding this troublesome future-compatibility warning.

Fixed in 521fbfe.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants