diff options
Diffstat (limited to 'src/test/compile-fail/send-is-not-static-ensures-scoping.rs')
| -rw-r--r-- | src/test/compile-fail/send-is-not-static-ensures-scoping.rs | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/test/compile-fail/send-is-not-static-ensures-scoping.rs b/src/test/compile-fail/send-is-not-static-ensures-scoping.rs index fe03ca8353d..2e401ba6e90 100644 --- a/src/test/compile-fail/send-is-not-static-ensures-scoping.rs +++ b/src/test/compile-fail/send-is-not-static-ensures-scoping.rs @@ -8,14 +8,24 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::thread; +struct Guard<'a> { + f: Box<Fn() + Send + 'a>, +} + +fn scoped<'a, F: Fn() + Send + 'a>(f: F) -> Guard<'a> { + Guard { f: Box::new(f) } +} + +impl<'a> Guard<'a> { + fn join(self) {} +} fn main() { let bad = { let x = 1; let y = &x; //~ ERROR `x` does not live long enough - thread::scoped(|| { + scoped(|| { //~^ ERROR `y` does not live long enough let _z = y; }) |
