With async functions coming closer to stabilization I think this is an important to discuss. Under the current proposal if you have an async fn foo() -> usize it gets desugared to an fn foo() -> impl Future<Output = usize> . This has the problem that all -> impl Trait functions have of having an innameable return type. The solution for normal functions comes in the form of existencial type. Writen using the syntax proposed here we can write

type FooReturn = impl Trait; fn foo -> FooReturn { /**/ }

instead of

fn foo() -> impl Trait { /**/ }

as the author of the function to name the return type FooReturn . Because we don’t write -> impl Future<Output = usize> but -> usize in the current proposal this solution does not work for async functions and we will later have to create some special syntax for naming the return type in this way.

I feel like this is an important questing discussed here and that we should think of a solution for this before we stabalize async foo() -> usize . To avoid blocking in this we could initially only allow async blocks. Those have the same power as async function because the async function

async fn foo() -> usize { /**/ }

is just sugar for

fn foo() -> impl Future<Output = usize> { async { /**/ } }

which is a normal function with its body wrapped in an async block.

Personally I feel like stabilizing -> T at this time without looking at things like this would be a mistake. I feel like using -> T for a function that does not return T is confusing and that the unnameable return type is a symptom of a larger issue. This issue is that we are special casing these functions in a way where we will keep having to come up with workarounds for things that already work for normal functions. An other example of this is specifying additional trait bounds. @withoutboats proposed a while back to use

async(Sync) fn foo() -> usize

for an async function that returns impl -> Future<Output = usize> + Send . With the outer return type this does not have to be a special case at all as we can just write