Skip to content

Commit

Permalink
libstd: Add Fn/FnMut/FnOnce to the prelude.
Browse files Browse the repository at this point in the history
Closes #16600.
  • Loading branch information
pcwalton committed Aug 19, 2014
1 parent 3f5d0b5 commit e0a165c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/libstd/prelude.rs
Expand Up @@ -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};

Expand Down
19 changes: 19 additions & 0 deletions src/test/run-pass/unboxed-closures-prelude.rs
@@ -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, ));
}

5 comments on commit e0a165c

@bors
Copy link
Contributor

@bors bors commented on e0a165c Aug 20, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from huonw
at pcwalton@e0a165c

@bors
Copy link
Contributor

@bors bors commented on e0a165c Aug 20, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging pcwalton/rust/unboxed-closures-prelude = e0a165c into auto

@bors
Copy link
Contributor

@bors bors commented on e0a165c Aug 20, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pcwalton/rust/unboxed-closures-prelude = e0a165c merged ok, testing candidate = 05df25f

@bors
Copy link
Contributor

@bors bors commented on e0a165c Aug 20, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = 05df25f

Please sign in to comment.