-
-
Notifications
You must be signed in to change notification settings - Fork 0
Enforce no (stable) auto traits are implemented for the returned Future #1
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
Comments
what do you mean by this? |
I meant something like (more complicated than) this (play): use std::marker::PhantomData;
async fn foo() {
let _phantom = PhantomData::<*mut ()>;
}
fn assert_send_sync(_: impl Send + Sync) {}
fn main() {
assert_send_sync(foo());
} Then the attribute may have to add an |
I think the problematic case is really when such a non- |
Done. 82f8627 @hyd-dev wdyt about |
I personally prefer EDIT: Another reason: |
See also https://github.com/tokio-rs/tokio/blob/master/tokio/tests/async_send_sync.rs, which enforces |
Currently
#[clear]
(and maybe also#[set]
) do not enforce that as this compiles:Because
impl Future
does not hide auto traits.The enforcement could be done through something like this (play):
Or something like this (but may not work properly for
async fn
s that have no.await
, play):(Moved from rust-lang/rust#82187 (comment), sorry for being off-topic there!)
The text was updated successfully, but these errors were encountered: