fwiw I think Cell is the most notable non-Sync type, and Rc is the most notable *non-Send* type :)
-
-
Replying to @glaebhoerl
This is aimed at people who don't know Rust well, so I wanted to avoid getting into Send or Cells -- Rc is the easiest to explain one :)
2 replies 0 retweets 1 like -
Replying to @Gankra_ @glaebhoerl
having read Ralf Jung's post, it occurs to me: but wasn't the MutexGuard bug caused by the compiler relying on struct members being Send %
1 reply 0 retweets 0 likes -
Replying to @H2CO3_iOS @glaebhoerl
% (which is incorrect) instead of them being Sync when inferring impl Sync for MutexGuard?
2 replies 0 retweets 0 likes -
Replying to @H2CO3_iOS @glaebhoerl
No, the compiler relies (only) on stuff being Sync to impl Sync. There is additionally an impl of &T: Send for T:Sync.
1 reply 0 retweets 0 likes -
Replying to @ManishEarth @glaebhoerl
How should I interpret the highlighed sentence, then?pic.twitter.com/8XdgOfomcM
1 reply 0 retweets 0 likes -
Replying to @H2CO3_iOS @glaebhoerl
"if you follow through", this is a combination of features interacting together
2 replies 0 retweets 1 like -
MutexGuard contains an &Mutex. Mutex itself is Sync+Send when T is Send, due to an impl. So is &Mutex, then. So is MutexGuard, then.
1 reply 0 retweets 1 like -
rustc only inferred the second two steps. The rest was explicitly provided to it; we *told* the compiler "T: Send => Mutex<T>: Sync+Send"
2 replies 0 retweets 0 likes -
relevant line: unsafe impl<T: ?Sized + Send> Sync for Mutex<T> { }
2 replies 0 retweets 2 likes
It really does seem like using `PhantomData` would have made more sense than opting out of the autotrait impl
-
-
PhantomData<&mut T> I suppose? Perhaps. I wonder how the variance of that works out. Actually, there's a chance variance is wrong there.
1 reply 1 retweet 1 like -
Yes. The variance shouldn't change since it'll still have the `&Mutex<T>` reference with the same lifetime.
1 reply 0 retweets 0 likes - 7 more replies
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.