Please help a little noob!

I could not understand what happened,please help me solve this noob question!Many thanks!

error[E0308]: mismatched types
   --> /home/sun/.cargo/registry/src/index.crates.io-6f17d22bba15001f/dtn7-0.21.0/src/bin/dtntrigger.rs:111:13
    |
110 |         match msg {
    |               --- this expression has type `dtn7_plus::client::Message`
111 |             Message::Text(txt) => {
    |             ^^^^^^^^^^^^^^^^^^ expected `Message`, found `tungstenite::Message`
    |
    = note: `tungstenite::Message` and `Message` have similar names, but are actually distinct types
note: `tungstenite::Message` is defined in crate `tungstenite`
   --> /home/sun/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tungstenite-0.17.3/src/protocol/message.rs:160:1
    |
160 | pub enum Message {
    | ^^^^^^^^^^^^^^^^
note: `Message` is defined in crate `tungstenite`
   --> /home/sun/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tungstenite-0.21.0/src/protocol/message.rs:160:1
    |
160 | pub enum Message {
    | ^^^^^^^^^^^^^^^^
    = note: perhaps two different versions of crate `tungstenite` are being used?

error[E0308]: mismatched types
   --> /home/sun/.cargo/registry/src/index.crates.io-6f17d22bba15001f/dtn7-0.21.0/src/bin/dtntrigger.rs:115:13
    |
110 |         match msg {
    |               --- this expression has type `dtn7_plus::client::Message`
...
115 |             Message::Binary(bin) => {
    |             ^^^^^^^^^^^^^^^^^^^^ expected `Message`, found `tungstenite::Message`
    |
    = note: `tungstenite::Message` and `Message` have similar names, but are actually distinct types
note: `tungstenite::Message` is defined in crate `tungstenite`
   --> /home/sun/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tungstenite-0.17.3/src/protocol/message.rs:160:1
    |
160 | pub enum Message {
    | ^^^^^^^^^^^^^^^^
note: `Message` is defined in crate `tungstenite`
   --> /home/sun/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tungstenite-0.21.0/src/protocol/message.rs:160:1
    |
160 | pub enum Message {
    | ^^^^^^^^^^^^^^^^
    = note: perhaps two different versions of crate `tungstenite` are being used?

error[E0308]: mismatched types
   --> /home/sun/.cargo/registry/src/index.crates.io-6f17d22bba15001f/dtn7-0.21.0/src/bin/dtntrigger.rs:131:13
    |
110 |         match msg {
    |               --- this expression has type `dtn7_plus::client::Message`
...
131 |             Message::Ping(_) => {
    |             ^^^^^^^^^^^^^^^^ expected `Message`, found `tungstenite::Message`
    |
    = note: `tungstenite::Message` and `Message` have similar names, but are actually distinct types
note: `tungstenite::Message` is defined in crate `tungstenite`
   --> /home/sun/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tungstenite-0.17.3/src/protocol/message.rs:160:1
    |
160 | pub enum Message {
    | ^^^^^^^^^^^^^^^^
note: `Message` is defined in crate `tungstenite`
   --> /home/sun/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tungstenite-0.21.0/src/protocol/message.rs:160:1
    |
160 | pub enum Message {
    | ^^^^^^^^^^^^^^^^
    = note: perhaps two different versions of crate `tungstenite` are being used?

error[E0308]: mismatched types
   --> /home/sun/.cargo/registry/src/index.crates.io-6f17d22bba15001f/dtn7-0.21.0/src/bin/dtntrigger.rs:136:13
    |
110 |         match msg {
    |               --- this expression has type `dtn7_plus::client::Message`
...
136 |             Message::Pong(_) => {
    |             ^^^^^^^^^^^^^^^^ expected `Message`, found `tungstenite::Message`
    |
    = note: `tungstenite::Message` and `Message` have similar names, but are actually distinct types
note: `tungstenite::Message` is defined in crate `tungstenite`
   --> /home/sun/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tungstenite-0.17.3/src/protocol/message.rs:160:1
    |
160 | pub enum Message {
    | ^^^^^^^^^^^^^^^^
note: `Message` is defined in crate `tungstenite`
   --> /home/sun/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tungstenite-0.21.0/src/protocol/message.rs:160:1
    |
160 | pub enum Message {
    | ^^^^^^^^^^^^^^^^
    = note: perhaps two different versions of crate `tungstenite` are being used?

error[E0308]: mismatched types
   --> /home/sun/.cargo/registry/src/index.crates.io-6f17d22bba15001f/dtn7-0.21.0/src/bin/dtntrigger.rs:141:13
    |
110 |         match msg {
    |               --- this expression has type `dtn7_plus::client::Message`
...
141 |             Message::Close(_) => {
    |             ^^^^^^^^^^^^^^^^^ expected `Message`, found `tungstenite::Message`
    |
    = note: `tungstenite::Message` and `Message` have similar names, but are actually distinct types
note: `tungstenite::Message` is defined in crate `tungstenite`
   --> /home/sun/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tungstenite-0.17.3/src/protocol/message.rs:160:1
    |
160 | pub enum Message {
    | ^^^^^^^^^^^^^^^^
note: `Message` is defined in crate `tungstenite`
   --> /home/sun/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tungstenite-0.21.0/src/protocol/message.rs:160:1
    |
160 | pub enum Message {
    | ^^^^^^^^^^^^^^^^
    = note: perhaps two different versions of crate `tungstenite` are being used?

error[E0308]: mismatched types
   --> /home/sun/.cargo/registry/src/index.crates.io-6f17d22bba15001f/dtn7-0.21.0/src/bin/dtntrigger.rs:147:13
    |
110 |         match msg {
    |               --- this expression has type `dtn7_plus::client::Message`
...
147 |             Message::Frame(_) => {
    |             ^^^^^^^^^^^^^^^^^ expected `Message`, found `tungstenite::Message`
    |
    = note: `tungstenite::Message` and `Message` have similar names, but are actually distinct types
note: `tungstenite::Message` is defined in crate `tungstenite`
   --> /home/sun/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tungstenite-0.17.3/src/protocol/message.rs:160:1
    |
160 | pub enum Message {
    | ^^^^^^^^^^^^^^^^
note: `Message` is defined in crate `tungstenite`
   --> /home/sun/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tungstenite-0.21.0/src/protocol/message.rs:160:1
    |
160 | pub enum Message {
    | ^^^^^^^^^^^^^^^^
    = note: perhaps two different versions of crate `tungstenite` are being used?

For more information about this error, try `rustc --explain E0308`.
error: could not compile `dtn7` (bin "dtntrigger") due to 6 previous errors
warning: build failed, waiting for other jobs to finish...
error: failed to compile `dtn7 v0.21.0`, intermediate artifacts can be found at `/tmp/cargo-installId3SqC`.
To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.

you are my heroes,thank you!!!

First, it's appreciated if you can format the errors (and any code samples) according to Forum Code Formatting and Syntax Highlighting

The error messages are a bit wordy, but long story short, you seem to be trying to match a value of type dtn7_plus::client::Message against patterns for type tungstenite::Message. If you look at your use statements, have you perhaps imported tungstenite::Message?

4 Likes

Try running this command:

cargo update -p dtn7-plus --precise 0.7.1

This will downgrade the dtn7-plus crate to an older version. The new version depends on tungstenite 0.21, making it incompatible with the latest dtn7 crate which uses tungstenite 0.17. (Making this backward-incompatible change in a patch release was a mistake by the dtn7-plus maintainer.)

5 Likes

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.