-
-
Notifications
You must be signed in to change notification settings - Fork 463
rand_core: add compatibility shim around 0.5 #819
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
Conversation
That didn't work: implementations are using the wrong |
So, I believe it is impossible to build a compatibility shim:
However, Hence: I think we must yank The only alternative would be a clean break (i.e. users may not use old and new Rand versions simultaneously). |
It is in fact possible to build a (one-way) compatibility shim: the goal is of course that types using one version of the traits are compatible with types using the other version, so we can e.g. implement all 0.4 traits for any type supporting the 0.5 traits. (Note: the I think this is the better direction to provide compatibility, since it allows any library providing an RNG to be updated immediately, and consumers of RNGs to update once all their required RNGs have updated. (The other way would be problematic: libs providing RNGs would never be able to update without potential compatibility issues.) |
No, a blanket impl like this seems to be impossible: impl<T: rand_core5::RngCore> RngCore for T { ... } E.g. for @burdges any ideas? I can't see a solution without removing one of the three blanket impls (crippling |
I pushed my implementation (complete other than the above issue). |
I'm not sure I understand the problem but yes |
I don't think we can do that in a compatibility shim. This is a patch release over 0.4.0 and thus cannot have any API changes. |
My understanding is that a true compatibility shim is not an option, in which case we have only very few options:
Thoughts? (I'm thinking go with 1.) |
I also prefer option 1. |
I'll make a PR soon with the new crate versions. I already unyanked crates which did bump the minor version. |
@dhardy is there any chance to coordinate it with Rust? |
@mati865 coordinate in what way? Those PRs failed because I released breaking changes in patch releases. |
@dhardy sorry for misunderstanding, I was under impression the breakage is going to happen again. |
If anyone needs it then I wrote out a one-way wrapper type adapter/shims as I agree I suppose you might add specific impls for
Yet, anything that defines their own |
Agreed. Lacking a good place to put these wrapper types, I think the best approach is if anyone needing them simply copies the code / adds their own? There are |
I've a branch that does this correctly now. I doubt cargo feature work on stable, so I might factor I never managed to invoke with_cause correctly, but whatever. |
Time to let CI do its thing...