Skip to content

Instantly share code, notes, and snippets.

@olsonjeffery
Last active December 20, 2015 10:39
Show Gist options
  • Save olsonjeffery/6117567 to your computer and use it in GitHub Desktop.
Save olsonjeffery/6117567 to your computer and use it in GitHub Desktop.
jeff@mbp:~/src/rust/build$ make check-stage1-extra
cfg: build triple x86_64-unknown-linux-gnu
cfg: host triples x86_64-unknown-linux-gnu
cfg: target triples x86_64-unknown-linux-gnu
cfg: host for x86_64-unknown-linux-gnu is x86_64
cfg: os for x86_64-unknown-linux-gnu is unknown-linux-gnu
cfg: using gcc
cfg: no pandoc found, omitting docs
cfg: no llnextgen found, omitting grammar-verification
cfg: no pandoc found, omitting library doc build
cfg: including dist rules
cfg: including test rules
compile_and_link: x86_64-unknown-linux-gnu/stage0/lib/rustc/x86_64-unknown-linux-gnu/lib/libstd.so
/home/jeff/src/rust/src/libstd/rt/uv/uvio.rs:246:35: 261:9 error: capture of moved value: `cleanup_cb`
/home/jeff/src/rust/src/libstd/rt/uv/uvio.rs:246 do tcp_watcher.connect(addr) |stream_watcher, status| {
/home/jeff/src/rust/src/libstd/rt/uv/uvio.rs:247 rtdebug!("connect: in connect callback");
/home/jeff/src/rust/src/libstd/rt/uv/uvio.rs:248 if status.is_none() {
/home/jeff/src/rust/src/libstd/rt/uv/uvio.rs:249 rtdebug!("status is none");
/home/jeff/src/rust/src/libstd/rt/uv/uvio.rs:250 let tcp_watcher =
/home/jeff/src/rust/src/libstd/rt/uv/uvio.rs:251 NativeHandle::from_native_handle(stream_watcher.native_handle());
...
/home/jeff/src/rust/src/libstd/rt/uv/uvio.rs:256:34: 259:17 note: `cleanup_cb` moved into closure environment here because it has type `~fn:Send()`, which is non-copyable (perhaps you meant to use clone()?)
/home/jeff/src/rust/src/libstd/rt/uv/uvio.rs:256 do stream_watcher.close {
/home/jeff/src/rust/src/libstd/rt/uv/uvio.rs:257 let res = Err(status.get());
/home/jeff/src/rust/src/libstd/rt/uv/uvio.rs:258 cleanup_cb(res);
/home/jeff/src/rust/src/libstd/rt/uv/uvio.rs:259 }
/home/jeff/src/rust/src/libstd/rt/uv/uvio.rs:256:34: 259:17 error: capture of moved value: `cleanup_cb`
/home/jeff/src/rust/src/libstd/rt/uv/uvio.rs:256 do stream_watcher.close {
/home/jeff/src/rust/src/libstd/rt/uv/uvio.rs:257 let res = Err(status.get());
/home/jeff/src/rust/src/libstd/rt/uv/uvio.rs:258 cleanup_cb(res);
/home/jeff/src/rust/src/libstd/rt/uv/uvio.rs:259 }
/home/jeff/src/rust/src/libstd/rt/uv/uvio.rs:256:34: 259:17 note: `cleanup_cb` moved into closure environment here because it has type `~fn:Send()`, which is non-copyable (perhaps you meant to use clone()?)
/home/jeff/src/rust/src/libstd/rt/uv/uvio.rs:256 do stream_watcher.close {
/home/jeff/src/rust/src/libstd/rt/uv/uvio.rs:257 let res = Err(status.get());
/home/jeff/src/rust/src/libstd/rt/uv/uvio.rs:258 cleanup_cb(res);
/home/jeff/src/rust/src/libstd/rt/uv/uvio.rs:259 }
error: aborting due to 2 previous errors
make: *** [x86_64-unknown-linux-gnu/stage0/lib/rustc/x86_64-unknown-linux-gnu/lib/libstd.so] Error 101
jeff@mbp:~/src/rust/build$
fn tcp_connect_common(&mut self, addr: IpAddr,
cleanup_cb: ~fn(Result<TcpWatcher, UvError>)) {
let mut tcp_watcher = TcpWatcher::new(self.uv_loop());
// Wait for a connection
do tcp_watcher.connect(addr) |stream_watcher, status| {
rtdebug!("connect: in connect callback");
if status.is_none() {
rtdebug!("status is none");
let tcp_watcher =
NativeHandle::from_native_handle(stream_watcher.native_handle());
let res = Ok(tcp_watcher);
cleanup_cb(res);
} else {
rtdebug!("status is some");
do stream_watcher.close {
let res = Err(status.get());
cleanup_cb(res);
}
};
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment