FnMut type should be used with a mutable reference#970
FnMut type should be used with a mutable reference#970ehuss merged 1 commit intorust-lang:masterfrom
FnMut type should be used with a mutable reference#970Conversation
FnMut typeFnMut type should be used with a mutable reference
|
Thanks, can you provide some more context on this change? What is the motivation for it? |
|
Since |
ehuss
left a comment
There was a problem hiding this comment.
OK, I think I understand now. The previous API would allow creating multiple immutable references when it shouldn't. I'm not entirely clear how that can manifest as an issue (since there are several lifetime restrictions in place). It would be interesting to see some example that would be a problem.
I'm also curious if there is some more ergonomic API that could handle this situation. Requiring &mut for closures that aren't FnMut seems a bit unfortunate. I tried a few ideas but couldn't come up with anything that would work. If anyone has ideas, it would be appreciated.
I'm going to go ahead and merge since this seems correct to me, and I don't have any ideas on how to make it better.
No description provided.