diff options
| author | Steven Fackler <sfackler@gmail.com> | 2013-09-17 23:23:20 -0700 |
|---|---|---|
| committer | Steven Fackler <sfackler@gmail.com> | 2013-09-19 09:06:42 -0700 |
| commit | 2df5a13334449c26204333e8b2cdce2dd0cf90eb (patch) | |
| tree | 99c4e053396d7c89fac35614a38559aeb1b51b8d | |
| parent | da29a8e6be0af399ef8b350fa4b6d124d2610bf7 (diff) | |
| download | rust-2df5a13334449c26204333e8b2cdce2dd0cf90eb.tar.gz rust-2df5a13334449c26204333e8b2cdce2dd0cf90eb.zip | |
Removed future's destructor
It was only there to prevent Future from being copyable, but it's noncopyable anyways since it contains a ~fn.
| -rw-r--r-- | src/libextra/future.rs | 9 | ||||
| -rw-r--r-- | src/test/compile-fail/future_not_copyable.rs | 19 |
2 files changed, 19 insertions, 9 deletions
diff --git a/src/libextra/future.rs b/src/libextra/future.rs index 74a551c6f6d..55e003de9da 100644 --- a/src/libextra/future.rs +++ b/src/libextra/future.rs @@ -37,15 +37,6 @@ pub struct Future<A> { priv state: FutureState<A>, } -// n.b. It should be possible to get rid of this. -// Add a test, though -- tjc -// FIXME(#2829) -- futures should not be copyable, because they close -// over ~fn's that have pipes and so forth within! -#[unsafe_destructor] -impl<A> Drop for Future<A> { - fn drop(&mut self) {} -} - enum FutureState<A> { Pending(~fn() -> A), Evaluating, diff --git a/src/test/compile-fail/future_not_copyable.rs b/src/test/compile-fail/future_not_copyable.rs new file mode 100644 index 00000000000..7ffa76d4096 --- /dev/null +++ b/src/test/compile-fail/future_not_copyable.rs @@ -0,0 +1,19 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +extern mod extra; + +use extra::future; + +fn main() { + let f = future::from_value(()); + let g = f; + f.unwrap(); //~ ERROR use of moved value +} |
