Cargo.toml specify Rust version

I am working through A Minimal Rust Kernel | Writing an OS in Rust

I would like a situation where:

  1. by default, I use rust-stable

  2. for the crate rust_os, I use rust-nightly

Question: is there a way to modify rust_os/Cargo.toml so that for this one particular crate, it gets compiled with rust nightly?

There isn't a specified ABI to support calling between Rust versions, so everything needs to use the same compiler. Just don't use any #![feature(...)] in the stable-only crates.

Do you want to have rust-stable everywhere but for some project(s) rust-nightly?
If this is the case, you can use rustup override feature.
Go do project when you want to have nightly version and type:
rustup override set nightly

https://rust-lang.github.io/rustup/overrides.html#directory-overrides

1 Like

Can I ask why you are deleting the comment? rustup override looks like the right solution to this problem

Well, to be honest, I thought that I misunderstood you question after posting it. What is more, I noticed that this solution is already written in a link you provided :wink: If this solution works for you, then my comment is reverted.

1 Like

This is my fault for skipping from code block to code block, jumping over the intermediate paragraphs. :slight_smile:

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.