core: make the Rng a by-value parameter of Distribution::sample - #160205
core: make the Rng a by-value parameter of Distribution::sample#160205joboet wants to merge 1 commit into
Rng a by-value parameter of Distribution::sample#160205Conversation
|
r? @jhpratt rustbot has assigned @jhpratt. Use Why was this reviewer chosen?The reviewer was selected based on:
|
Note that this PR can result in the exact thing it wants to prevent — more complex implementations of |
|
That's a very good point. I'll nominate for libs-api to make sure using by-ref is an explicit decision. @rustbot label +I-libs-api-nominated |
Given that
&mut Rnow implementsRngifRdoes (#159435), I think it makes more sense forDistribution::sampleto take theRngby-value instead of by-ref. For stateless zero-sized types likeSystemRngthis is more efficient and convenient, and for everything else creating a reference still works just the same.