Test that you can't implement Unpin for a compiler-generated future using TAIT#157069
Test that you can't implement Unpin for a compiler-generated future using TAIT#157069Darksonn wants to merge 1 commit into
Conversation
|
|
This comment has been minimized.
This comment has been minimized.
7023463 to
307310c
Compare
| impl Unpin for MyFut {} | ||
| //~^ ERROR: only traits defined in the current crate can be implemented for arbitrary types |
There was a problem hiding this comment.
All compiler-generated futures should probably come with an implicit impl !Unpin so that this doesn't rely on orphan rules.
There was a problem hiding this comment.
opaque types are always considered to be an unknown type. You cannot get their underlying type during coherence (and we don't allow auto trait leakage during coherence either)
we may want to improve the diagnostics here, but it is very much intended that impls can't look into opaque types.
We could in theory add the functionality to reveal opaque types during coherence, and at this point either manually implement !Unpin for couroutines, forbid impls on coroutines by treating them as foreign, or sth else. But for now that doesn't matter as you cannot reveal opaque types during coherence checking at all
I came up with this while trying to break pinning. Seems like a good idea to have a test that this doesn't change.
r? @RalfJung