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
I was just looking at testing integrating some code with Hyper's master branch. The first problem I came across was that the existing code uses BoxStream to represent its body type, which cannot be converted into hyper::Body because it additionally wants Sync on the trait object:
I don't see why Sync would be necessary, since I see no usecases where the type is accessed concurrently from different threads, but it seems to be pretty common to require both markers for trait objects (e.g. there is Into<Box<dyn Error + Send + Sync>> but not Into<Box<dyn Error + Send>> which I have run into, and seen others run into, multiple times).
I can't think of any Send + !Sync type right now, and it seems like a niche usecase if they do exist.
More specifically the bug that Hyper is running into appears to be rust-lang/rust#59245 (viarust-lang/rust#57017 causing the match patterns to create unnecessary references, but it would still be possible to hit #59245 without #57017).
It seems to me that it's definitely a bug in the generator transform, if the reference is internal then there's no need for the referenced value to be Sync.
Either way, is there a downside to adding + Sync here? Skimming the docs I notice that Cell, RefCell and mpsc::{Receiver, Sender} appear to be the only types that are Send + !Sync.
I was just looking at testing integrating some code with Hyper's master branch. The first problem I came across was that the existing code uses
BoxStream
to represent its body type, which cannot be converted intohyper::Body
because it additionally wantsSync
on the trait object:I don't see why
Sync
would be necessary, since I see no usecases where the type is accessed concurrently from different threads, but it seems to be pretty common to require both markers for trait objects (e.g. there isInto<Box<dyn Error + Send + Sync>>
but notInto<Box<dyn Error + Send>>
which I have run into, and seen others run into, multiple times).I can't think of any
Send + !Sync
type right now, and it seems like a niche usecase if they do exist.cc @seanmonstar
The text was updated successfully, but these errors were encountered: