Pronoy Chopra

Pronoy Chopra

Developer/Engineer

© Pronoy Chopra 2020

Theme: plainwhite

Rust async is only available in 2018 edition error

A common issue while working with a cargo project is seeing an annoying squiggly line under async keyword with the error

async error

Despite what this issue says it’s not just a plugin error that was fixed. The Rust plugin expects a workspace for this error to go away.

When you create a rust project you need to have a parent Cargo.toml file declaring workspaces in order for this plugin to recognize a binary. Here’s an example

mkdir parent-directory && cd parent-directory
cargo new --bin myproject
touch Cargo.toml

Your parent Cargo.toml should like this

[workspace]
members = [
  "myproject",
]

And that should fix that