#![feature(async_await, futures_api)]

#![feature(async_await, futures_api)]

async fn foo(x: &mut i32, y: &mut i32) -> i32 {
    *x += *y;
    *y += *x;
    *x + *y


Hi and welcome. It looks like you've found the option to share code in the Playground. If you have any questions feel free to ask them here. (In case you don't want to discuss code with others, feel free to avoid opening new topics in this forum this way.)

What I can see is that your code contains some very very old feature flags from the time when futures and async fn was still in development in the Rust compiler. Those feature flags are redundant nowadays, as the compiler warnings will tell you.

What I can also see is that your playground is configured in edition 2015 mode. In this compilation mode, the Rust compiler will not support the async keyword, in order to stay backwards compatible with very old Rust code that might have decided to use "async" as a variable or function name, before it became a keyword.

Change the playground to a newer edition to avoid the compilation error: Rust Playground

In case you're encountering similar issues locally on your computer, make sure to use cargo and have the editon = "2021" property configured in your project's Cargo.toml file. Or if rustc must be used manually, then it needs the explicit --edition=2022 Command line argument in order to use something else than edition 2015. (The currently latest edition is 2021, but that will change in the future. This year edition 2024 will come out, and the general plan at the moment is to publish language editions every 3 years.)