Uh oh!
There was an error while loading. Please reload this page.
Test and fix Send and Sync traits of BTreeMap artefacts - #76722
Conversation
There was a problem hiding this comment.
Don't you want &mut T to be Send, not T?
| unsafeimpl<'a,T:Sync>SyncforDormantMutRef<'a,T>{} | |
| unsafeimpl<'a,T:Send>SendforDormantMutRef<'a,T>{} | |
| unsafeimpl<'a,T>SyncforDormantMutRef<'a,T>where&'amutT:Sync{} | |
| unsafeimpl<'a,T>SendforDormantMutRef<'a,T>where&'amutT:Send{} |
There was a problem hiding this comment.
Is there any tangible difference? That implementation is already:
unsafeimpl<T:Send + ?Sized>Sendfor&mutT{}And I believe Sync for &mut T is auto-implemented for T: Sync.
There was a problem hiding this comment.
You could have unsafe impl<T> Send for &mut T {}, even if T is not Send.
There was a problem hiding this comment.
And in general this is conceptually a &mut T so it makes sense to use the same rules as &mut T for it.
There was a problem hiding this comment.
Yeah, I think they might match up in practice, but I didn't want to replicate impls when we could just use this.
There was a problem hiding this comment.
I guess core could pull that trick, but nobody else:
structFoo(*consti32);unsafeimplSendfor&mutFoo{}error[E0119]: conflicting implementations of trait `std::marker::Send` for type `&mut Foo`:
--> src/lib.rs:3:1
|
3 | unsafe impl Send for &mut Foo {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: conflicting implementation in crate `core`:
- impl<T> std::marker::Send for &mut T
where T: std::marker::Send, T: ?Sized;
error[E0321]: cross-crate traits with a default impl, like `std::marker::Send`, can only be implemented for a struct/enum type, not `&mut Foo`
--> src/lib.rs:3:1
|
3 | unsafe impl Send for &mut Foo {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't implement cross-crate trait with a default impl for non-struct/enum type
Mark-Simulacrum
commented
Sep 15, 2020
@jyn514 is correct, I think, that we want these in terms of &mut T. r=me with that change made |
ssomers
commented
Sep 15, 2020
Also got more fine grained testing to compile and added newcomers |
jyn514
commented
Sep 15, 2020
@bors r=Mark-Simulacrum |
bors
commented
Sep 15, 2020
📌 Commit 176956c has been approved by |
…ulacrum Test and fix Send and Sync traits of BTreeMap artefacts Fixesrust-lang#76686. I'm not quite sure what all this implies. E.g. comparing with the definitions for `NodeRef` in node.rs, maybe an extra bound `T: 'a` is useful for something. The test compiles on stable/beta (apart from `drain_filter`) so I bet `Sync` is equally desirable. r? @Mark-Simulacrum
…ulacrum Test and fix Send and Sync traits of BTreeMap artefacts Fixesrust-lang#76686. I'm not quite sure what all this implies. E.g. comparing with the definitions for `NodeRef` in node.rs, maybe an extra bound `T: 'a` is useful for something. The test compiles on stable/beta (apart from `drain_filter`) so I bet `Sync` is equally desirable. r? @Mark-Simulacrum
…ulacrum Test and fix Send and Sync traits of BTreeMap artefacts Fixesrust-lang#76686. I'm not quite sure what all this implies. E.g. comparing with the definitions for `NodeRef` in node.rs, maybe an extra bound `T: 'a` is useful for something. The test compiles on stable/beta (apart from `drain_filter`) so I bet `Sync` is equally desirable. r? @Mark-Simulacrum
…ulacrum Test and fix Send and Sync traits of BTreeMap artefacts Fixesrust-lang#76686. I'm not quite sure what all this implies. E.g. comparing with the definitions for `NodeRef` in node.rs, maybe an extra bound `T: 'a` is useful for something. The test compiles on stable/beta (apart from `drain_filter`) so I bet `Sync` is equally desirable. r? @Mark-Simulacrum
…ulacrum Test and fix Send and Sync traits of BTreeMap artefacts Fixesrust-lang#76686. I'm not quite sure what all this implies. E.g. comparing with the definitions for `NodeRef` in node.rs, maybe an extra bound `T: 'a` is useful for something. The test compiles on stable/beta (apart from `drain_filter`) so I bet `Sync` is equally desirable. r? @Mark-Simulacrum
…ulacrum Test and fix Send and Sync traits of BTreeMap artefacts Fixesrust-lang#76686. I'm not quite sure what all this implies. E.g. comparing with the definitions for `NodeRef` in node.rs, maybe an extra bound `T: 'a` is useful for something. The test compiles on stable/beta (apart from `drain_filter`) so I bet `Sync` is equally desirable. r? @Mark-Simulacrum
RalfJung
commented
Sep 20, 2020
@bors rollup |
Rollup of 15 pull requests Successful merges: - rust-lang#76722 (Test and fix Send and Sync traits of BTreeMap artefacts) - rust-lang#76766 (Extract some intrinsics out of rustc_codegen_llvm) - rust-lang#76800 (Don't generate bootstrap usage unless it's needed) - rust-lang#76809 (simplfy condition in ItemLowerer::with_trait_impl_ref()) - rust-lang#76815 (Fix wording in mir doc) - rust-lang#76818 (Don't compile regex at every function call.) - rust-lang#76821 (Remove redundant nightly features) - rust-lang#76823 (black_box: silence unused_mut warning when building with cfg(miri)) - rust-lang#76825 (use `array_windows` instead of `windows` in the compiler) - rust-lang#76827 (fix array_windows docs) - rust-lang#76828 (use strip_prefix over starts_with and manual slicing based on pattern length (clippy::manual_strip)) - rust-lang#76840 (Move to intra doc links in core/src/future) - rust-lang#76845 (Use intra docs links in core::{ascii, option, str, pattern, hash::map}) - rust-lang#76853 (Use intra-doc links in library/core/src/task/wake.rs) - rust-lang#76871 (support panic=abort in Miri) Failed merges: r? `@ghost`
Fixes#76686.
I'm not quite sure what all this implies. E.g. comparing with the definitions for
NodeRefin node.rs, maybe an extra boundT: 'ais useful for something. The test compiles on stable/beta (apart fromdrain_filter) so I betSyncis equally desirable.r? @Mark-Simulacrum