Search code examples
rustrust-cargo

How to fix "this version of Cargo is older than the `2021` edition" error?


I am using cargo on a Chromebook Lenovo Duet 5. I have this error just as I try to code something a little more complex. I was trying to import an image package and got this error:

this version of Cargo is older than the `2021` edition, and only supports `2015` and `2018` editions.

I suspect that maybe that image package is only built for x86_64 and I just happen to be learning Rust on ARM. I tried to build cargo from source using the binary cargo I have, but that also has the same error.


Solution

  • Your problem is not a platform difference; you simply have an old version. The 2021 language edition was added with Rust release version 1.56.0, in October 2021. You need to install a Rust version that is at least that new.

    The recommended way to install and maintain a Rust toolchain is with Rustup. I can personally confirm that it will work on ARM Chromebook Linux.