Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

These types are very hard to read #66269

Closed
ofzo opened this issue Nov 10, 2019 · 4 comments
Closed

These types are very hard to read #66269

ofzo opened this issue Nov 10, 2019 · 4 comments
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-enhancement Category: An issue proposing an enhancement or a PR with one. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@ofzo
Copy link

ofzo commented Nov 10, 2019

These type are very hard to read~
😪😪


`std::sync::MutexGuard<'_, std::boxed::Box<std::collections::HashMap<u32, std::sync::Arc<std::boxed::Box<futures::stream::SplitSink<tokio::codec::Framed<tokio::net::TcpStream, websocket::async::MessageCodec<websocket::OwnedMessage>>>>>>>>` cannot be sent between threads safely
`std::sync::MutexGuard<'_, std::boxed::Box<std::collections::HashMap<u32, std::sync::Arc<std::boxed::Box<futures::stream::SplitSink<tokio::codec::Framed<tokio::net::TcpStream, websocket::async::MessageCodec<websocket::OwnedMessage>>>>>>>>` cannot be sent between threads safely
help: the trait `std::marker::Send` is not implemented for `std::sync::MutexGuard<'_, std::boxed::Box<std::collections::HashMap<u32, std::sync::Arc<std::boxed::Box<futures::stream::SplitSink<tokio::codec::Framed<tokio::net::TcpStream, websocket::async::MessageCodec<websocket::OwnedMessage>>>>>>>>`
note: required because of the requirements on the impl of `std::marker::Send` for `&mut std::sync::MutexGuard<'_, std::boxed::Box<std::collections::HashMap<u32, std::sync::Arc<std::boxed::Box<futures::stream::SplitSink<tokio::codec::Framed<tokio::net::TcpStream, websocket::async::MessageCodec<websocket::OwnedMessage>>>>>>>>`
note: required because it appears within the type `[closure@src/main.rs:115:31: 142:22 p:&mut std::sync::MutexGuard<'_, std::boxed::Box<std::collections::HashMap<u32, std::sync::Arc<std::boxed::Box<futures::stream::SplitSink<tokio::codec::Framed<tokio::net::TcpStream, websocket::async::MessageCodec<websocket::OwnedMessage>>>>>>>>]`
note: required because it appears within the type `futures::future::chain::Chain<std::boxed::Box<dyn futures::Future<Error = websocket::WebSocketError, Item = (tokio::codec::Framed<tokio::net::TcpStream, websocket::async::MessageCodec<websocket::OwnedMessage>>, hyper::header::Headers)> + std::marker::Send>, futures::AndThen<futures::stream::Forward<futures::stream::FilterMap<futures::stream::TakeWhile<futures::stream::SplitStream<tokio::codec::Framed<tokio::net::TcpStream, websocket::async::MessageCodec<websocket::OwnedMessage>>>, [closure@src/main.rs:122:41: 122:62], std::result::Result<bool, websocket::WebSocketError>>, [closure@src/main.rs:123:41: 130:30]>, std::boxed::Box<futures::stream::SplitSink<tokio::codec::Framed<tokio::net::TcpStream, websocket::async::MessageCodec<websocket::OwnedMessage>>>>>, futures::sink::Send<std::boxed::Box<futures::stream::SplitSink<tokio::codec::Framed<tokio::net::TcpStream, websocket::async::MessageCodec<websocket::OwnedMessage>>>>>, [closure@src/main.rs:141:39: 141:87]>, [closure@src/main.rs:115:31: 142:22 p:&mut std::sync::MutexGuard<'_, std::boxed::Box<std::collections::HashMap<u32, std::sync::Arc<std::boxed::Box<futures::stream::SplitSink<tokio::codec::Framed<tokio::net::TcpStream, websocket::async::MessageCodec<websocket::OwnedMessage>>>>>>>>]>`
note: required because it appears within the type `futures::AndThen<std::boxed::Box<dyn futures::Future<Error = websocket::WebSocketError, Item = (tokio::codec::Framed<tokio::net::TcpStream, websocket::async::MessageCodec<websocket::OwnedMessage>>, hyper::header::Headers)> + std::marker::Send>, futures::AndThen<futures::stream::Forward<futures::stream::FilterMap<futures::stream::TakeWhile<futures::stream::SplitStream<tokio::codec::Framed<tokio::net::TcpStream, websocket::async::MessageCodec<websocket::OwnedMessage>>>, [closure@src/main.rs:122:41: 122:62], std::result::Result<bool, websocket::WebSocketError>>, [closure@src/main.rs:123:41: 130:30]>, std::boxed::Box<futures::stream::SplitSink<tokio::codec::Framed<tokio::net::TcpStream, websocket::async::MessageCodec<websocket::OwnedMessage>>>>>, futures::sink::Send<std::boxed::Box<futures::stream::SplitSink<tokio::codec::Framed<tokio::net::TcpStream, websocket::async::MessageCodec<websocket::OwnedMessage>>>>>, [closure@src/main.rs:141:39: 141:87]>, [closure@src/main.rs:115:31: 142:22 p:&mut std::sync::MutexGuard<'_, std::boxed::Box<std::collections::HashMap<u32, std::sync::Arc<std::boxed::Box<futures::stream::SplitSink<tokio::codec::Framed<tokio::net::TcpStream, websocket::async::MessageCodec<websocket::OwnedMessage>>>>>>>>]>`
note: required because it appears within the type `futures::MapErr<futures::AndThen<std::boxed::Box<dyn futures::Future<Error = websocket::WebSocketError, Item = (tokio::codec::Framed<tokio::net::TcpStream, websocket::async::MessageCodec<websocket::OwnedMessage>>, hyper::header::Headers)> + std::marker::Send>, futures::AndThen<futures::stream::Forward<futures::stream::FilterMap<futures::stream::TakeWhile<futures::stream::SplitStream<tokio::codec::Framed<tokio::net::TcpStream, websocket::async::MessageCodec<websocket::OwnedMessage>>>, [closure@src/main.rs:122:41: 122:62], std::result::Result<bool, websocket::WebSocketError>>, [closure@src/main.rs:123:41: 130:30]>, std::boxed::Box<futures::stream::SplitSink<tokio::codec::Framed<tokio::net::TcpStream, websocket::async::MessageCodec<websocket::OwnedMessage>>>>>, futures::sink::Send<std::boxed::Box<futures::stream::SplitSink<tokio::codec::Framed<tokio::net::TcpStream, websocket::async::MessageCodec<websocket::OwnedMessage>>>>>, [closure@src/main.rs:141:39: 141:87]>, [closure@src/main.rs:115:31: 142:22 p:&mut std::sync::MutexGuard<'_, std::boxed::Box<std::collections::HashMap<u32, std::sync::Arc<std::boxed::Box<futures::stream::SplitSink<tokio::codec::Framed<tokio::net::TcpStream, websocket::async::MessageCodec<websocket::OwnedMessage>>>>>>>>]>, [closure@src/main.rs:145:31: 145:57]>`
note: required because it appears within the type `futures::Map<futures::MapErr<futures::AndThen<std::boxed::Box<dyn futures::Future<Error = websocket::WebSocketError, Item = (tokio::codec::Framed<tokio::net::TcpStream, websocket::async::MessageCodec<websocket::OwnedMessage>>, hyper::header::Headers)> + std::marker::Send>, futures::AndThen<futures::stream::Forward<futures::stream::FilterMap<futures::stream::TakeWhile<futures::stream::SplitStream<tokio::codec::Framed<tokio::net::TcpStream, websocket::async::MessageCodec<websocket::OwnedMessage>>>, [closure@src/main.rs:122:41: 122:62], std::result::Result<bool, websocket::WebSocketError>>, [closure@src/main.rs:123:41: 130:30]>, std::boxed::Box<futures::stream::SplitSink<tokio::codec::Framed<tokio::net::TcpStream, websocket::async::MessageCodec<websocket::OwnedMessage>>>>>, futures::sink::Send<std::boxed::Box<futures::stream::SplitSink<tokio::codec::Framed<tokio::net::TcpStream, websocket::async::MessageCodec<websocket::OwnedMessage>>>>>, [closure@src/main.rs:141:39: 141:87]>, [closure@src/main.rs:115:31: 142:22 p:&mut std::sync::MutexGuard<'_, std::boxed::Box<std::collections::HashMap<u32, std::sync::Arc<std::boxed::Box<futures::stream::SplitSink<tokio::codec::Framed<tokio::net::TcpStream, websocket::async::MessageCodec<websocket::OwnedMessage>>>>>>>>]>, [closure@src/main.rs:145:31: 145:57]>, [closure@src/main.rs:146:30: 146:63]>`rustc(E0277)
main.rs(144, 26): `std::sync::MutexGuard<'_, std::boxed::Box<std::collections::HashMap<u32, std::sync::Arc<std::boxed::Box<futures::stream::SplitSink<tokio::codec::Framed<tokio::net::TcpStream, websocket::async::MessageCodec<websocket::OwnedMessage>>>>>>>>` cannot be sent between threads safely

@jonas-schievink jonas-schievink added A-diagnostics Area: Messages for errors, warnings, and lints C-enhancement Category: An issue proposing an enhancement or a PR with one. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Nov 10, 2019
@memoryruins
Copy link
Contributor

Was this on stable 1.39.0 or a nightly toolchain?
Can you provide an example or playground that causes this error?

@estebank
Copy link
Contributor

CC #21934.

@ofzo ofzo changed the title These type are very hard to read These types are very hard to read Nov 11, 2019
@jonas-schievink
Copy link
Contributor

This is a duplicate of #21934, so closing in favor of that

@najamelan
Copy link
Contributor

@Uploy See also #50310 and #58088 which make suggestions beyond #21934.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-enhancement Category: An issue proposing an enhancement or a PR with one. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

5 participants