-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Implement Random
for tuple
#136801
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
Implement Random
for tuple
#136801
Conversation
The implementation looks reasonable to me, but this will need T-libs-api approval. r? libs-api |
☔ The latest upstream changes (presumably #138873) made this pull request unmergeable. Please resolve the merge conflicts. |
b0098b7
to
8f97955
Compare
☔ The latest upstream changes (presumably #138881) made this pull request unmergeable. Please resolve the merge conflicts. |
Implement `Random` for tuples of arity 12 or less. Each element is expected to implement `Random`.
8f97955
to
07e8b28
Compare
Seems reasonable given the current unstable trait. Whether we end up with this exact trait is another question, but this seems reasonable for unstable. @bors r+ rollup |
Rollup of 12 pull requests Successful merges: - #136801 (Implement `Random` for tuple) - #141867 (Describe Future invariants more precisely) - #142760 (docs(fs): Touch up grammar on lock api) - #143181 (Improve testing and error messages for malformed attributes) - #143210 (`tests/ui`: A New Order [19/N] ) - #143212 (`tests/ui`: A New Order [20/N]) - #143230 ([COMPILETEST-UNTANGLE 2/N] Make some compiletest errors/warnings/help more visually obvious) - #143240 (Port `#[rustc_object_lifetime_default]` to the new attribute parsing …) - #143255 (Do not enable LLD by default in the dist profile) - #143262 (mir: Mark `Statement` and `BasicBlockData` as `#[non_exhaustive]`) - #143269 (bootstrap: make comment more clear) - #143279 (Remove `ItemKind::descr` method) Failed merges: - #143237 (Port `#[no_implicit_prelude]` to the new attribute parsing infrastructure) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of #136801 - sorairolake:add-random-for-tuple, r=joshtriplett Implement `Random` for tuple Implement `Random` for tuples of arity 12 or less. Each element is expected to implement `Random`. I think it's OK to implement this trait for the following types: - Primitive integer types and `bool` - Arrays and tuples of the above values - ~~`NonZero<T>`~~, `Saturating<T>` and `Wrapping<T>` The necessity of this trait is debated (<#130703 (comment)>), but if we decide to keep it in the future when the `random` module is stabilized, I think it would be useful to have this trait implemented for tuples. Tracking issue: #130703 r? `@joboet`
Implement
Random
for tuples of arity 12 or less. Each element is expected to implementRandom
.I think it's OK to implement this trait for the following types:
bool
,NonZero<T>
Saturating<T>
andWrapping<T>
The necessity of this trait is debated (#130703 (comment)), but if we decide to keep it in the future when the
random
module is stabilized, I think it would be useful to have this trait implemented for tuples.Tracking issue: #130703
r? @joboet