}
struct WindowCallbacks<'a> {
- pos_callback: Option<WindowPosCallback<'a>>,
+ pos_callback: Option<Box<FnMut(&Window, i32, i32) + 'a>>,
}
-pub type WindowPosCallback<'a> = |&Window, i32, i32|: 'a;
-
fn main() {
let x = WindowCallbacks { pos_callback: None };
}
// CLOSURES
-// gdb-command:whatis stack_closure1
-// gdb-check:type = struct (&mut|int|, uint)
+// gdb-command:whatis closure1
+// gdb-check:type = struct (closure, uint)
-// gdb-command:whatis stack_closure2
-// gdb-check:type = struct (&mut|i8, f32| -> f32, uint)
+// gdb-command:whatis closure2
+// gdb-check:type = struct (closure, uint)
#![omit_gdb_pretty_printer_section]
// how that maps to rustc's internal representation of these forms.
// Once closures have reached their 1.0 form, the tests below should
// probably be expanded.
- let stack_closure1 = (|x:int| {}, 0u);
- let stack_closure2 = (|x:i8, y: f32| { (x as f32) + y }, 0u);
+ let closure1 = (|&: x:int| {}, 0u);
+ let closure2 = (|&: x:i8, y: f32| { (x as f32) + y }, 0u);
zzz(); // #break
}
let struct_ref = &a_struct;
let owned = box 6;
- let closure = || {
+ let mut closure = |&mut:| {
let closure_local = 8;
- let nested_closure = || {
+ let mut nested_closure = |&mut:| {
zzz(); // #break
variable = constant + a_struct.a + struct_ref.a + *owned + closure_local;
};
let owned = box 6;
{
- let closure = || {
+ let mut first_closure = |&mut:| {
zzz(); // #break
variable = constant + a_struct.a + struct_ref.a + *owned;
};
- closure();
+ first_closure();
}
{
- let mut unboxed_closure = |&mut:| {
+ let mut second_closure = |&mut:| {
zzz(); // #break
variable = constant + a_struct.a + struct_ref.a + *owned;
};
- unboxed_closure();
+ second_closure();
}
}