You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Really had no idea what to call this, feel free to change. As soon as I annotate the type of i when I create it or when I add to it, it works. I of course intended to annotate the type, but I did notice this and figured I'd post it in case it's not intentional.
externcrate libc;fnmain(){fnf<F>(f:F)whereF:FnMut(&str){let down = &f as*const_as*mut libc::c_void;let up = down as*mutF;let s = "lol what";unsafe{(*up)(s);}}letmut i = 3;f(|&mut: data:&str| {println!("data is: {}", data);
i += 3;});println!("i is now: {}", i);}
Error:
<anon>:13:5: 13:6 error: unable to infer enough type information about `closure[<anon>:13:7: 16:6]`; type annotations required
<anon>:13 f(|&mut: data: &str| {
^
error: aborting due to previous error
playpen: application terminated with error code 101
Really had no idea what to call this, feel free to change. As soon as I annotate the type of
i
when I create it or when I add to it, it works. I of course intended to annotate the type, but I did notice this and figured I'd post it in case it's not intentional.Error:
playpen
The text was updated successfully, but these errors were encountered: