-
Notifications
You must be signed in to change notification settings - Fork 13.2k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Make resuming generators unsafe instead of the creation of immovable generators #49194
Conversation
r? @cramertj (rust_highfive has picked a reviewer for you, use r? to override) |
Awesome! Thanks @Zoxc. Looks like a few of the tests still need |
496c585
to
55d73db
Compare
Travis passes now. |
@@ -18,7 +18,7 @@ impl<T: Generator<Return = ()>> Iterator for W<T> { | |||
type Item = T::Yield; | |||
|
|||
fn next(&mut self) -> Option<Self::Item> { | |||
match self.0.resume() { | |||
match unsafe { self.0.resume() } { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This impl isn't actually sound anymore since the iterator can move-- can you leave a comment? (I think it's fine to leave it because the Pin
version will come soon, but there should probably be a note about it)
@bors r+ The |
📌 Commit 55d73db has been approved by |
📌 Commit 57896ab has been approved by |
Nice :) |
Make resuming generators unsafe instead of the creation of immovable generators cc @withoutboats Fixes rust-lang#47787
Make resuming generators unsafe instead of the creation of immovable generators Fixes rust-lang#47787
Make resuming generators unsafe instead of the creation of immovable generators cc @withoutboats Fixes rust-lang#47787
As of rust-lang/rust#49194 it's now unsafe to resume a generator, but safe to create an immovable generator. Fixes alexcrichton#74
As of rust-lang/rust#49194 it's now unsafe to resume a generator, but safe to create an immovable generator. Fixes alexcrichton#74
cc @withoutboats
Fixes #47787