khyperia / weechat-discord

Unmaintained! And also apparently this is against their TOS so DON'T USE THIS -- Weechat plugin for Discord support - https://weechat.org/ https://discordapp.com/
MIT License
51 stars 24 forks source link

Compilation error: non-capturing closure is experimental #32

Closed stagnation closed 7 years ago

stagnation commented 7 years ago

weechat-discord does not compile under a decently new cargo, see bottom for version listings.

~/d/g/weechat-discord *master cargo build --release
   Compiling serde_derive v1.0.10
   Compiling weecord v0.1.0 (file:///home/spill/dotfiles/gits/weechat-discord)
   Compiling url v1.5.1
   Compiling cookie v0.2.5
   Compiling hyper v0.9.18
   Compiling websocket v0.17.1
   Compiling multipart v0.8.1
   Compiling discord v0.8.0 (https://github.com/SpaceManiac/discord-rs.git#2f48893b)
error: non-capturing closure to fn coercion is experimental (see issue #39817)
   --> src/connection.rs:124:35
    |
124 |             Buffer::new(&name_id, |_, _| {}).unwrap()
    |                                   ^^^^^^^^^
    |
    = help: add #![feature(closure_to_fn_coercion)] to the crate attributes to enable

error[E0308]: mismatched types
   --> src/connection.rs:124:35
    |
124 |             Buffer::new(&name_id, |_, _| {}).unwrap()
    |                                   ^^^^^^^^^ expected fn pointer, found closure
    |
    = note: expected type `fn(ffi::Buffer, &str)`
               found type `[closure@src/connection.rs:124:35: 124:44]`

error: aborting due to previous error(s)

error: Could not compile `weecord`.
spill@spilldesk:~/dotfiles/gits/weechat-discord$ git rev-parse HEAD
cf9f593648179976696dffe6e95536b7274a220b

spill@spilldesk:~/dotfiles/gits/weechat-discord$ gcc --version
gcc (Debian 4.9.2-10) 4.9.2
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

spill@spilldesk:~/dotfiles/gits/weechat-discord$ rustc --version
rustc 1.19.0-nightly (28fd1e519 2017-05-27)

spill@spilldesk:~/dotfiles/gits/weechat-discord$ cargo --version
cargo 0.20.0-nightly (38ca9b702 2017-05-14)

spill@spilldesk:~/dotfiles/gits/weechat-discord$ weechat --version
1.6
stagnation commented 7 years ago

It compiles following the help message

~/d/g/weechat-discord *master git diff
diff --git a/src/lib.rs b/src/lib.rs
index d1bd63c..6f04d6c 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1,3 +1,5 @@
+#![feature(closure_to_fn_coercion)]
+
 extern crate discord;
 extern crate libc;
khyperia commented 7 years ago

a decently new cargo

You are using rustc 1.19.0-nightly (28fd1e519 2017-05-27). The current stable version is rustc 1.19.0 (the current nightly is 1.21.0-nightly (c417ee9ae 2017-07-25)). Please update your cargo/rustc to the current stable version and try again :)

khyperia commented 7 years ago

I'm closing this for now, as I fully expect upgrading rustc will resolve the issue. Please reopen this if this is not the case. Thanks! :blush:

stagnation commented 7 years ago

Yes sorry, thank you for the quick reply. The proposed fix issues a warning on 1.21, which is also annoying so I retract that recommendation :-)