websockets-rs / rust-websocket

A WebSocket (RFC6455) library written in Rust

Home Page:http://websockets-rs.github.io/rust-websocket/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Warning: Contains Code That Will Become an Error in a Future Release of Rust

DanteVillarreal opened this issue · comments

[hyper 0.10.15] (https://github.com/hyperium/hyper/blob/0.10.x/Cargo.toml), which depends on traitobject 0.1.0 "contains code that will become an error in future versions of rust."

I was making a websocket client in your awesome crate, and after many days of working at it, I finally got it to work. Thank God. However, upon further inspection, I got a warning. To my surprise, it wasn't in my own code. It was from one of the packages that this crate relies on:

Here is the long version of the warnings I got:

The package traitobject v0.1.0` currently triggers the following future incompatibility lints:

warning: conflicting implementations of trait Trait for type (dyn Send + Sync + 'static): (E0119)
--> C:\Users\djv60.cargo\registry\src\index.crates.io-6f17d22bba15001f\traitobject-0.1.0\src\impls.rs:72:1
|
71 | unsafe impl Trait for ::std::marker::Send + Sync { }
| ------------------------------------------------ first implementation here
72 | unsafe impl Trait for ::std::marker::Send + Send + Sync { }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for (dyn Send + Sync + 'static)
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #56484 rust-lang/rust#56484
= note: #[allow(order_dependent_trait_objects)] on by default

warning: conflicting implementations of trait Trait for type (dyn Send + Sync + 'static): (E0119)
--> C:\Users\djv60.cargo\registry\src\index.crates.io-6f17d22bba15001f\traitobject-0.1.0\src\impls.rs:73:1
|
72 | unsafe impl Trait for ::std::marker::Send + Send + Sync { }
| ------------------------------------------------------- first implementation here
73 | unsafe impl Trait for ::std::marker::Sync + Send { }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for (dyn Send + Sync + 'static)
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #56484 rust-lang/rust#56484
= note: #[allow(order_dependent_trait_objects)] on by default

warning: conflicting implementations of trait Trait for type (dyn Send + Sync + 'static): (E0119)
--> C:\Users\djv60.cargo\registry\src\index.crates.io-6f17d22bba15001f\traitobject-0.1.0\src\impls.rs:75:1
|
73 | unsafe impl Trait for ::std::marker::Sync + Send { }
| ------------------------------------------------ first implementation here
74 | unsafe impl Trait for ::std::marker::Sync + Sync { }
75 | unsafe impl Trait for ::std::marker::Sync + Send + Sync { }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for (dyn Send + Sync + 'static)
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #56484 rust-lang/rust#56484
= note: #[allow(order_dependent_trait_objects)] on by default`

What steps should I take next?

Have you tried using tungstenite (or tokio-tungstenite / async-tungstenite) instead of websocket crate? It depends on modern dependencies, unlike websocket.

Have you tried using tungstenite (or tokio-tungstenite / async-tungstenite) instead of websocket crate? It depends on modern dependencies, unlike websocket.

Wow. thanks for the super fast reply. I was expecting a reply in a few weeks, at best.
To answer your question, after I got the warning of impending doom, I tried to use tokio-tungstenite, but I think it'll take me a few days to get the code working. How do people learn a library so fast?

How do people learn a library so fast?

What do you mean by "learning a library"? If you can one library (e.g. for WebSockets) then starting using another library for the same thing is likely to be relatively straightforward, unless you need some tricky or low-level details.

In some sense, libraries in general are created to avoid people learning the whole topic (e.g. WebSockets) and instead just learn simpler thing (e.g. Tunhstenite or rust-websocket API or examples).

it'll take me a few days to get the code working

Why the estimate is so high? Why can't websocket implementation provider be swapped in e.g. an hour?