-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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 crate to 0.8 #2893
update rand crate to 0.8 #2893
Conversation
hello @g-k nice to see you here ;) & thanks for the patch Looks like clippy is complaining on it: |
Hi Sylvestre, good to see you here too! Updates:
error[E0599]: the method `gen` exists for mutable reference `&mut G`, but its trait bounds were not satisfied
Error: --> src/uu/factor/src/factor.rs:281:11
|
281 | g.gen()
| ^^^ method cannot be called on `&mut G` due to unsatisfied trait bounds
|
= note: the following trait bounds were not satisfied:
`G: rand::RngCore`
which is required by `G: Rng`
`&mut G: rand::RngCore`
which is required by `&mut G: Rng`
= help: items from traits can only be used if the trait is in scope
help: the following trait is implemented but not in scope; perhaps add a `use` for it:
|
8 | use rand::Rng;
| I'll try to address that on a failing architecture. |
I was going through our issues and found some related issues: |
Aha, thanks Terts! I closed the issue I made in rust-random/rand and I'll copy the relevant code over. How closely is this project trying to match GNU coreutils? I didn't see that documented anywhere, but #2528 makes a good case for switching to |
In general, we try to stay as close as possible, at least for now. In practice, it also depends on how much a feature is used. I like the solution you've come up with! |
To me, the priority is to have rust/coreutils as a dropped in replacement but I don't mind adding stuff (or adding aliases) when it makes sense |
c1c6f48
to
114835e
Compare
Cool! That makes sense. I'll keep this PR focused on updating Rebased on the clap 3 upgrade and:
failures:
---- test_du::test_du_h_flag_empty_file stdout ----
current_directory_resolved:
run: /home/gguthe/coreutils/target/debug/coreutils du -h empty.txt
thread 'test_du::test_du_h_flag_empty_file' panicked at 'assertion failed: `(left == right)`
Diff < left / right > :
<"1.0K\tempty.txt\n"
>"0\tempty.txt\n"
', tests/common/util.rs:233:9
---- test_du::test_du_threshold stdout ----
current_directory_resolved:
run: /home/gguthe/coreutils/target/debug/coreutils du --threshold=10K
thread 'test_du::test_du_threshold' panicked at ''11 .
' does not contain 'links'', tests/common/util.rs:386:9
---- test_du::test_du_time stdout ----
current_directory_resolved:
run: /home/gguthe/coreutils/target/debug/coreutils touch -a -t 201505150000 date_test
run: /home/gguthe/coreutils/target/debug/coreutils touch -m -t 201606160000 date_test
run: /home/gguthe/coreutils/target/debug/coreutils du --time date_test
thread 'test_du::test_du_time' panicked at 'assertion failed: `(left == right)`
Diff < left / right > :
<"1\t2016-06-16 00:00\tdate_test\n"
>"0\t2016-06-16 00:00\tdate_test\n"
', tests/common/util.rs:233:9
---- test_ls::test_ls_long_total_size stdout ----
current_directory_resolved:
touch: /tmp/.tmp9T0aPj/test-long
write(append): /tmp/.tmp9T0aPj/test-long
touch: /tmp/.tmp9T0aPj/test-long2
write(append): /tmp/.tmp9T0aPj/test-long2
run: /home/gguthe/coreutils/target/debug/coreutils ls -l
thread 'test_ls::test_ls_long_total_size' panicked at ''total 2
-rw-rw-r-- 1 gguthe gguthe 1 Jan 20 21:07 test-long
-rw-rw-r-- 1 gguthe gguthe 1 Jan 20 21:07 test-long2
' does not contain 'total 8'', tests/common/util.rs:386:9
failures:
test_du::test_du_h_flag_empty_file
test_du::test_du_threshold
test_du::test_du_time
test_ls::test_ls_long_total_size
test result: FAILED. 1444 passed; 4 failed; 27 ignored; 0 measured; 0 filtered out; finished in 28.86s edit: fixed import and cspell test failures (hadn't cleaned the shuf cache) |
@@ -54,6 +55,7 @@ hashsums | |||
infile | |||
iflag | |||
iflags | |||
impls |
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.
Alternatively, ignore the spelling error on the line where it's imported (if that's supported) and rename it to implementations
or another word that doesn't get flagged for subsequent uses.
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 think this is fine, impl (and hence impls) are such common words in Rust-related writing that it belongs on the jargon list. Might be better suited to put under abbreviations though?
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.
Good call, done!
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.
Oh interesting hahaha, I was looking at a different abbreviations list (in jargon.wordlist.txt
) but this is fine! Thanks!
Repro'd the earlier E0599 error on aarch64-apple-darwin and updated factor's
edit: Looks like it's #1559 and related to BurntSushi/quickcheck@71d743a |
Just to check that I understand the issue correctly. You updated quickcheck, which now generates numbers from the entire range of a numeric type, which overflows the factor tests because it multiplies numbers from that range? Can we (in some cases) fix this more elegantly by telling quickcheck we want |
Yep! On I haven't dug into how BurntSushi/quickcheck@71d743a might've caused it to use such a small range.
Possibly, the Other options:
I'm sure I've missed other options too. Digging into how quickcheck uses the |
Alright, thanks for the explanation! Given these options, I think the current implementation is fine then! |
Fix 'value of type `char` cannot be built from `std::iter::Iterator<Item=u8>`' for split test. refs: https://docs.rs/rand/0.8.4/rand/distributions/struct.Alphanumeric.html#example
Fix 'error[E0061]: this function takes 1 argument but 2 arguments were supplied'.
It is deprecated pending future removal. This version copied from: https://github.com/rust-random/rand/blob/0.8.4/src/rngs/adapter/read.rs
quickcheck <1 uses rand 0.6.x which results in E0599 errors. Upgrading resolves that error and lets us remove the older rand version from our deps. refs: https://stackoverflow.com/questions/56901973/errore0599-no-method-named-gen-found-for-type-mut-g-in-the-current-scope/56902740#56902740
Upstream removed the Gen trait and made the gen method private in BurntSushi/quickcheck@d286e4d
excellent, thanks :) |
Fix: #2888
make test
passes onaarch64-apple-darwin
rust v1.56.1