]> git.lizzy.rs Git - rust.git/commitdiff
libstd: Add `Fn`/`FnMut`/`FnOnce` to the prelude.
authorPatrick Walton <pcwalton@mimiga.net>
Tue, 19 Aug 2014 20:56:38 +0000 (13:56 -0700)
committerPatrick Walton <pcwalton@mimiga.net>
Tue, 19 Aug 2014 20:57:10 +0000 (13:57 -0700)
Closes #16600.

src/libstd/prelude.rs
src/test/run-pass/unboxed-closures-prelude.rs [new file with mode: 0644]

index eb6dcc1f1a586d250600d8b3fbfd39fa4a97532d..48ddfeaf5ffa09c2cd6474c8c56c9f935d9befa9 100644 (file)
@@ -46,6 +46,7 @@
 #[doc(no_inline)] pub use ops::{Drop, Deref, DerefMut};
 #[doc(no_inline)] pub use ops::{Shl, Shr};
 #[doc(no_inline)] pub use ops::{Index, IndexMut};
+#[doc(no_inline)] pub use ops::{Fn, FnMut, FnOnce};
 #[doc(no_inline)] pub use option::{Option, Some, None};
 #[doc(no_inline)] pub use result::{Result, Ok, Err};
 
diff --git a/src/test/run-pass/unboxed-closures-prelude.rs b/src/test/run-pass/unboxed-closures-prelude.rs
new file mode 100644 (file)
index 0000000..4226ed4
--- /dev/null
@@ -0,0 +1,19 @@
+// Copyright 2014 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.
+
+// Tests that the reexports of `FnOnce` et al from the prelude work.
+
+#![feature(unboxed_closures, unboxed_closure_sugar)]
+
+fn main() {
+    let task: Box<|: int| -> int> = box |: x| x;
+    task.call_once((0i, ));
+}
+