Skip to content
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

rand::distributions::Distribution::sample using &mut #908

Closed
burdges opened this issue Nov 16, 2019 · 2 comments
Closed

rand::distributions::Distribution::sample using &mut #908

burdges opened this issue Nov 16, 2019 · 2 comments

Comments

@burdges
Copy link
Contributor

burdges commented Nov 16, 2019

I suppose rand::distributions::Distribution::sample takes a &mut R instead of an R because otherwise the errors get confusing?

@dhardy
Copy link
Member

dhardy commented Nov 17, 2019

See this post.

@burdges burdges closed this as completed Nov 17, 2019
@burdges
Copy link
Contributor Author

burdges commented Nov 17, 2019

Thanks! I suppose monomorphization creates another issue if you wind up with separate entry points for each &mut &mut .. &mut R.

I've no idea if Rust can optimize those away, but if not then maybe idiomatic usage should really by BorrowMut<R> whenever you might want both R and &mut R.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants