0

I am trying to build an example "Marco Polo" game using Rust with GitHub's Codespaces. I am following an example from Week 1 of Coursera's "Data Engineering with Rust" course. However, the vesion of rustc in my codespaces is no longer sufficient for the current version of clap_builder, which seems to be required. My Cargo.toml file is as follows:

[package]
name = "hello_marco"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
clap = {version="4.0.32", features=["derive"]}

which matches the one given in the lesson. But, when I run it, I get this error:

error: package `clap_derive v4.5.0` cannot be built because it requires rustc 1.74 or newer, while the currently active rustc version is 1.70.0
Either upgrade to rustc 1.74 or newer, or use
cargo update -p [email protected] --precise ver
where `ver` is the latest version of `clap_derive` supporting rustc 1.70.0

I do not seem to be able to update my version of rustc:

@me ➜ /workspaces/MarcoPolo2/hello_marco (main) $ rustup update
info: no updatable toolchains installed
info: checking for self-update
info: downloading self-update
info: cleaning up downloads & tmp directories
@me ➜ /workspaces/MarcoPolo2/hello_marco (main) $ rustc --version
rustc 1.70.0 (90c541806 2023-05-31)

When I look at the Clap ChangeLog it appears as though v 4.3.24 is the first one to support my current rust compiler (assuming that this is what msrv [minimum supported rust version] means]). I was able (I believe) to successfully downgrade my version of clap by

@me ➜ /workspaces/MarcoPolo2/hello_marco (main) $ cargo update -p [email protected] --precise 4.3.24

But, I still want to know how can I force my codespaces environment to use the more recent rustc.

1 Answer 1

1

I had the same problem, taking the same course. I solved it in changing the line in your Dockerfile where you pull the rust image

FROM mcr.microsoft.com/devcontainers/rust:latest

I am assuming that you had

FROM mcr.microsoft.com/devcontainers/rust:0-1-bullseye

and then follow the advice if you use VSCODE to rebuild the image

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.