Skip to content

Conversation

@dhardy
Copy link
Member

@dhardy dhardy commented Mar 21, 2018

Implement #287 (as it currently stands). Without changes to Rust itself I think this is our best option. I'm unsure about making some further changes in the future; I guess it depends on the state of Rust when we want to make 1.0.

@dhardy dhardy added X-enhancement B-API Breakage: API P-high Priority: high D-review Do: needs review labels Mar 21, 2018
Copy link
Contributor

@pitdicker pitdicker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All looks good to me, and cleaner 👍. Also very readable documentation.

@dhardy dhardy mentioned this pull request Mar 22, 2018
33 tasks
@pitdicker
Copy link
Contributor

Do you want to wait for someone to review? Or is this ready to be merged?

@dhardy
Copy link
Member Author

dhardy commented Mar 22, 2018

I think it's good, but with significant changes like this I prefer to wait a couple of days.

/// // This uses StdRng, but is valid for any R: SeedableRng
/// let mut rng = StdRng::from_rng(&mut EntropyRng::new())?;
/// let mut rng = StdRng::from_rng(EntropyRng::new())?;
///
Copy link
Contributor

@burdges burdges Mar 22, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the examples and documentation should do &mut much more frequently than not, as inexperienced rust developers may find the error message from a missing &mut unintuitive. I don't see any problem with doing this one without the &mut of course.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using a different convention for from_rng than the other RNG consumers bugs me a bit, but seems the best option. It sounds like the RFC I opened about reborrowing is being postponed, so we're not going to get a nice uniform solution any time soon; I guess then this is the best we can do.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't checked the error message myself, but really that sounds like the only problematic part. If it's really confusion then we could suggest a rewording as a rustc bug, which get addressed quickly.

@dhardy
Copy link
Member Author

dhardy commented Mar 23, 2018

Merge collision 😒

I rebased; merge after CI checks are complete

@pitdicker pitdicker merged commit 8cca605 into rust-random:master Mar 23, 2018
@dhardy dhardy deleted the generics branch March 23, 2018 17:53
pitdicker added a commit that referenced this pull request Apr 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

B-API Breakage: API D-review Do: needs review P-high Priority: high

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants