-
Notifications
You must be signed in to change notification settings - Fork 14
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
Make impls apply for trait objects #52
Comments
Nice idea! Implementing this is fairly easy. But I noticed a problem: what should happen if the trait has a method with So should we just add |
Good catch -- when there are self-by-value methods then the impl shouldn't have a |
My question was rather about: if we conditionally add the Also we should probably ignore "self by value" methods which are marked with |
So I guess there are a few different directions we could take:
Personally, I think 1 (and maybe 2 as well?) would be ok. The argument about it being surprising is totally reasonable, but I think the fail wagon would ride like this: you define your trait as object safe and |
(I'm kind of conflating object safety with |
+1 for @KodrAus's option 1. If my code asks for |
Ok, I'm convinced! Will probably implement option 1 in the next days. |
My use case looks like https://github.com/auto-impl-rs/auto_impl/blob/90f17b69350204689730de3a5c4cc17d038d8d94/tests/compile-pass/trait_obj_immutable_self.rs so I think we can close this out. Thanks! |
It looks like there may be some
?Sized
bounds missing? I would expect the following auto impls to apply to<T: ?Sized> &T
and<T: ?Sized> Box<T>
but they don't.The text was updated successfully, but these errors were encountered: