-
-
Notifications
You must be signed in to change notification settings - Fork 485
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
Update rand dependency to 0.7 + some tweaks #622
base: main
Are you sure you want to change the base?
Conversation
I think you also can make |
I've submitted a PR with the described changes: dhardy#1 |
Thank you for this PR and sorry for the delay before this review! Right now the CI fails when trying to compile for a |
I've added a fix for the import in dhardy#2. Generally |
Thanks @dhardy and @newpavlov! |
Yes, looks like it's just missing a trait use. Unfortunately I can't fix this until next Wednesday. |
Taking a look... testing without the |
@dhardy Our tests are not designed to be run without the I’m surprised you get errors when running tests with the std feature since they are alway run by our CI. How did you run those tests exactly and what errors are you getting (could you show the output of rustc?) |
I'm confused on this one — first time I ran with the |
@dhardy I've investigated this and this is because of those changes:
Having Replacing |
I think it's not a good approach, since it will break modules which import from |
@newpavlov I see, thank you for the suggestion. Would you like to make the necessary changes (without |
Tests pass with default features (rand_with_std) Tests pass with std only, with --tests restriction (doc tests fail)
This keeps all those with a rename, macro import or other function.
I reworked this, revising @newpavlov's contributions (removing some and with cleaner commits). Hopefully it now passes tests and is in shape for merging. This also bumps the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure why you have removed the changes around core
and alloc
. As I've said earlier I think it's a bad idea to use extern core as std
. Unconditional #![no_std]
and cfg
'ed extern crate std;
is a significantly more clear and helps to spot errors around unconfiged uses of std
much easier. AFAIK such approach is used by many no_std crates with an optional std
support across Rust ecosystem.
I guess we can do it in a separate PR after this one is merged.
Also I don't understand the motivation behind rand_with_std
feature. Is it to just to save some typing? I don't think that #[cfg(all(feature = "rand", feature = "std"))]
is bad enough to warrant the addition of such feature.
alloc = [ ] | ||
io = [ "pest", "pest_derive" ] | ||
serde_derive = [] # dummy feature to avoid breakage |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR already is not backwards compatible with v0.18, why keep this feature? Same in the nalgebra-lapack
crate.
Same goes for the stdweb
feature, I think it should be removed in the same way as you plan to do in rust-random/rand#886.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll leave that decision to @sebcrozet
Because it was another big changeset on top of my one, and ultimately the point of this PR is (1) rand 0.7 and (2) optional rand.
Some things need e.g. |
There are still CI failures:
|
Ah, indeed. I thought that |
So right now It may be worth to use something like |
Perhaps it would make the most sense to remove uses of thread_rng entirely?
People who want it can reference it explicitly without much effort.
…On Mon, Sep 16, 2019, 08:26 Artyom Pavlov ***@***.***> wrote:
So right now rand_with_std is essentially used only for ThreadRng in
new_random_generic. I guess a separate crate for ThreadRng could've made
sense here, although we would simply replaced the feature with an optional
crate...
It may be worth to use something like thread_rng for the feature name
instead of rand_with_std to convey intent a bit more clearly.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#622>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAAZQ3XNGCGKIP4WA7JT76DQJ6QRNANCNFSM4IHEP2IA>
.
|
I'm hoping some day that Cargo will allow the |
3628f12
to
fb69a42
Compare
This PR is partially obsolete, because nalgebra uses rand 0.8. Are there some parts left that are worth porting or should this be closed? |
There is a bunch of changes which I've done in dhardy#1, which are still relevant in my opinion (mostly about making crates more idiomatic around handling of |
#864 was merged, which included some of the remaining changes in this PR. What still needs to be merged is the following:
|
700c4dc
to
c5c6c13
Compare
... I realise this is jumping the gun since
quickcheck
does not yet support Rand 0.7.Of course this is a breaking change (part of pub API).
Some of the distributions used here are somewhat arbitrary, but I guess are fine for testing purposes. However, this does lead to some slightly surprising code when re-used (
nphysics_testbed
):