From d49557a55a8b9d9630dd984247014b0fbf984043 Mon Sep 17 00:00:00 2001 From: edef Date: Sun, 5 Mar 2017 21:58:01 +0100 Subject: [PATCH] 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. --- src/generator.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/generator.rs b/src/generator.rs index b2ba5f5..1cd4525 100644 --- a/src/generator.rs +++ b/src/generator.rs @@ -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(stack: Stack, f: F) -> Generator<'a, Input, Output, Stack> - where Stack: stack::GuardedStack, + where Stack: stack::GuardedStack + 'static, F: FnOnce(&Yielder, Input) + 'a { unsafe { Generator::unsafe_new(stack, f) } }