zargony / fuse-rs

Rust library for filesystems in userspace (FUSE)
MIT License
1.07k stars 130 forks source link

use of proc() { } causes compilation to fail #31

Closed phi-gamma closed 9 years ago

phi-gamma commented 9 years ago

As of rustc version “rustc 0.13.0-nightly (42deaa5e4 2014-12-16 17:51:23 +0000)” the library fails to compile. The cause appears to be the removal of proc():

$ cargo build
   Compiling fuse v0.2.0 (file:///home/phg/src/rust-dev/rust-fuse-git)
src/reply.rs:27:34: 27:38 error: obsolete syntax: the `proc` type
src/reply.rs:27     fn new (unique: u64, sender: proc(&[&[u8]]):Send) -> Self;
                                                 ^~~~
note: use unboxed closures instead
cuviper commented 9 years ago

Niko has a large writeup on this change, Purging proc. Roughly summarized, functions will need to be defined with FnOnce parameters, and calls will need to change to move ||. But it doesn't look like a simple swap.

zsiciarz commented 9 years ago

I've started fixing that but got stuck at some point. If anyone's interested, the WIP patch is at the remove-proc branch in my fork.

zargony commented 9 years ago

This turns out to be more complicated than I expected. Especially because the closure should be FnOnce+Send, since the implementation of a filesystem should be able to pass the reply object to a different task (for asynchronous processing).

zargony commented 9 years ago

I finally managed to update the code to unboxed closures. It turned out to be more complicated than expected, because you can't easily store a closure that takes by reference parameters without getting problems with lifetime checks. Many thanks to @steveklabnik and @Kimundi for helping me on IRC and pointing me to the new (undocumented and somewhat strange) syntax for<'a> :)

phi-gamma commented 9 years ago

···<date: 2014-12-24, Wednesday>······

Closed #31.

Thanks for fixing! The resolution turned out to be pretty enlightening.