Require Stack to be 'static
Our strategy of leaking the Stack to ensure safety is only effective if the lifetime of the underlying stack memory is controlled by the destructor of the Stack. We don't add this bound to unsafe_new, so that users who wish to provide the necessary guarantees themselves can do so.
This commit is contained in:
parent
277e786d3f
commit
d49557a55a
@ -111,7 +111,7 @@ impl<'a, Input, Output, Stack> Generator<'a, Input, Output, Stack>
|
||||
///
|
||||
/// See also the [contract](../trait.GuardedStack.html) that needs to be fulfilled by `stack`.
|
||||
pub fn new<F>(stack: Stack, f: F) -> Generator<'a, Input, Output, Stack>
|
||||
where Stack: stack::GuardedStack,
|
||||
where Stack: stack::GuardedStack + 'static,
|
||||
F: FnOnce(&Yielder<Input, Output>, Input) + 'a {
|
||||
unsafe { Generator::unsafe_new(stack, f) }
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user