You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you use traits error messages can become very long and complicated to read.
Consider this error message:
error[E0599]: no method named `into_stream` found for type `futures_util::stream::stream::forward::Forward<impl futures_core::stream::TryStream, futures_util::sink::map_err::SinkMapErr<futures_util::sink::fanout::Fanout<futures_channel::mpsc::UnboundedSender<(bytes::bytes::Bytes, std::net::SocketAddr)>, futures_channel::mpsc::UnboundedSender<(bytes::bytes::Bytes, std::net::SocketAddr)>>,[closure@src/main.rs:218:47:218:101]>>` in the current scope
--> src/main.rs:220:19
|
220 | let foo = foo.into_stream();
| ^^^^^^^^^^^ method not found in `futures_util::stream::stream::forward::Forward<impl futures_core::stream::TryStream, futures_util::sink::map_err::SinkMapErr<futures_util::sink::fanout::Fanout<futures_channel::mpsc::UnboundedSender<(bytes::bytes::Bytes, std::net::SocketAddr)>, futures_channel::mpsc::UnboundedSender<(bytes::bytes::Bytes, std::net::SocketAddr)>>,[closure@src/main.rs:218:47:218:101]>>`
|
= note: the method `into_stream` exists but the following trait bounds were not satisfied:
`&futures_util::stream::stream::forward::Forward<impl futures_core::stream::TryStream, futures_util::sink::map_err::SinkMapErr<futures_util::sink::fanout::Fanout<futures_channel::mpsc::UnboundedSender<(bytes::bytes::Bytes, std::net::SocketAddr)>, futures_channel::mpsc::UnboundedSender<(bytes::bytes::Bytes, std::net::SocketAddr)>>,[closure@src/main.rs:218:47:218:101]>>: futures_util::future::future::FutureExt`
`&futures_util::stream::stream::forward::Forward<impl futures_core::stream::TryStream, futures_util::sink::map_err::SinkMapErr<futures_util::sink::fanout::Fanout<futures_channel::mpsc::UnboundedSender<(bytes::bytes::Bytes, std::net::SocketAddr)>, futures_channel::mpsc::UnboundedSender<(bytes::bytes::Bytes, std::net::SocketAddr)>>,[closure@src/main.rs:218:47:218:101]>>: futures_util::stream::try_stream::TryStreamExt`
`&mut futures_util::stream::stream::forward::Forward<impl futures_core::stream::TryStream, futures_util::sink::map_err::SinkMapErr<futures_util::sink::fanout::Fanout<futures_channel::mpsc::UnboundedSender<(bytes::bytes::Bytes, std::net::SocketAddr)>, futures_channel::mpsc::UnboundedSender<(bytes::bytes::Bytes, std::net::SocketAddr)>>,[closure@src/main.rs:218:47:218:101]>>: futures_util::future::future::FutureExt`
`&mut futures_util::stream::stream::forward::Forward<impl futures_core::stream::TryStream, futures_util::sink::map_err::SinkMapErr<futures_util::sink::fanout::Fanout<futures_channel::mpsc::UnboundedSender<(bytes::bytes::Bytes, std::net::SocketAddr)>, futures_channel::mpsc::UnboundedSender<(bytes::bytes::Bytes, std::net::SocketAddr)>>,[closure@src/main.rs:218:47:218:101]>>: futures_util::stream::try_stream::TryStreamExt`
`futures_util::stream::stream::forward::Forward<impl futures_core::stream::TryStream, futures_util::sink::map_err::SinkMapErr<futures_util::sink::fanout::Fanout<futures_channel::mpsc::UnboundedSender<(bytes::bytes::Bytes, std::net::SocketAddr)>, futures_channel::mpsc::UnboundedSender<(bytes::bytes::Bytes, std::net::SocketAddr)>>,[closure@src/main.rs:218:47:218:101]>>: futures_util::future::future::FutureExt`
`futures_util::stream::stream::forward::Forward<impl futures_core::stream::TryStream, futures_util::sink::map_err::SinkMapErr<futures_util::sink::fanout::Fanout<futures_channel::mpsc::UnboundedSender<(bytes::bytes::Bytes, std::net::SocketAddr)>, futures_channel::mpsc::UnboundedSender<(bytes::bytes::Bytes, std::net::SocketAddr)>>,[closure@src/main.rs:218:47:218:101]>>: futures_util::stream::try_stream::TryStreamExt`
Especially people new to rust can be overwhelmed by all the information and a lot of information here is redundant because the type of foo is repeated over and over again. pas_mtts on reddit came up with the idea to replace the actual type of foo (futures_util::stream::stream::forward::Forward<impl futures_core::stream::TryStream, futures_util::sink::map_err::SinkMapErr<futures_util::sink::fanout::Fanout<futures_channel::mpsc::UnboundedSender<(bytes::bytes::Bytes, std::net::SocketAddr)>, futures_channel::mpsc::UnboundedSender<(bytes::bytes::Bytes, std::net::SocketAddr)>>, [closure@src/main.rs:218:47: 218:101]>> ) with typeof(foo), so the error message would look like this:
error[E0599]: typeof(foo) = futures_util::stream::stream::forward::Forward<impl futures_core::stream::TryStream, futures_util::sink::map_err::SinkMapErr<futures_util::sink::fanout::Fanout<futures_channel::mpsc::UnboundedSender<(bytes::bytes::Bytes, std::net::SocketAddr)>, futures_channel::mpsc::UnboundedSender<(bytes::bytes::Bytes, std::net::SocketAddr)>>,[closure@src/main.rs:218:47:218:101]>>
no method named `into_stream` found for type `typeof(foo)` in the current scope
--> src/main.rs:220:19
|
220 | let foo = foo.into_stream();
| ^^^^^^^^^^^ method not found in `typeof(foo)`
|
= note: the method `into_stream` exists but the following trait bounds were not satisfied:
`&typeof(foo): futures_util::future::future::FutureExt`
`&typeof(foo): futures_util::stream::try_stream::TryStreamExt`
`&mut typeof(foo): futures_util::future::future::FutureExt`
`&mut typeof(foo): futures_util::stream::try_stream::TryStreamExt`
`typeof(foo): futures_util::future::future::FutureExt`
`typeof(foo): futures_util::stream::try_stream::TryStreamExt`
which is much nicer to read.
It would be great if rust would report errors like this and would make it much easier to read error messages in the console.
If you use traits error messages can become very long and complicated to read.
Consider this error message:
Especially people new to rust can be overwhelmed by all the information and a lot of information here is redundant because the type of
foo
is repeated over and over again. pas_mtts on reddit came up with the idea to replace the actual type offoo
(futures_util::stream::stream::forward::Forward<impl futures_core::stream::TryStream, futures_util::sink::map_err::SinkMapErr<futures_util::sink::fanout::Fanout<futures_channel::mpsc::UnboundedSender<(bytes::bytes::Bytes, std::net::SocketAddr)>, futures_channel::mpsc::UnboundedSender<(bytes::bytes::Bytes, std::net::SocketAddr)>>, [closure@src/main.rs:218:47: 218:101]>>
) withtypeof(foo)
, so the error message would look like this:which is much nicer to read.
It would be great if rust would report errors like this and would make it much easier to read error messages in the console.
Meta
rustc --version --verbose
:The text was updated successfully, but these errors were encountered: