diff --git a/src/generator.rs b/src/generator.rs index 8ad9923..913ae78 100644 --- a/src/generator.rs +++ b/src/generator.rs @@ -199,6 +199,7 @@ impl Yielder unsafe { let data = Context::swap(self.context, self.context, &mut val as *mut Option as usize); + mem::forget(val); let (new_context, input) = ptr::read(data as *mut (*mut Context, Input)); // The generator can be moved (and with it, the context). // This changes the address of the context.