Skip to content

Commit ba72789

Browse files
committed
Remove incorrect section from example
Closures no longer need to be `'static` as we now track the lifetime of the wrapped function
1 parent b8ed0a8 commit ba72789

File tree

1 file changed

+0
-7
lines changed

1 file changed

+0
-7
lines changed

examples/reflection/function_reflection.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,6 @@ fn main() {
6868
dbg!(increment_function.call_once(args).unwrap());
6969
assert_eq!(count, 5);
7070

71-
// All closures must be `'static`— that is, they take full ownership of any captured variables.
72-
let add_closure = |left: i32, right: i32| -> i32 { left + right };
73-
let mut count_function = dbg!(add_closure.into_function());
74-
let args = dbg!(ArgList::new().push_owned(2_i32).push_owned(2_i32));
75-
let value = dbg!(count_function.call(args).unwrap()).unwrap_owned();
76-
assert_eq!(value.take::<i32>().unwrap(), 4);
77-
7871
// As stated before, this works for many kinds of simple functions.
7972
// Functions with non-reflectable arguments or return values may not be able to be converted.
8073
// Generic functions are also not supported.

0 commit comments

Comments
 (0)