Skip to content

Specify minimum rust version #77

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed

Specify minimum rust version #77

wants to merge 1 commit into from

Conversation

d3zd3z
Copy link
Collaborator

@d3zd3z d3zd3z commented Apr 1, 2025

Specify a minimum rust version in the zephyr crate.

Currently, we require Rust 1.85 for a few reasons. There have been some subtle changes to warnings that cause build failures with older version. Specifically, the 2024 edition requires certain attributes to explicitly be marked as unsafe, but the construct to mark them as unsafe is only present in the 2024 compiler. There are also some subtle changes to warnings that affect our builds.

This specifies the exact tools that need to be present in order to build
these projects.  This should affect all of the samples.

Currently, we require Rust 1.85 for a few reasons.  There have been some
subtle changes to warnings that cause build failures with older version.
Specifically, the 2024 edition requires certain attributes to explicitly
be marked as unsafe, but the construct to mark them as unsafe is only
present in the 2024 compiler.  There are also some subtle changes to
warnings that affect our builds.

Signed-off-by: David Brown <[email protected]>
@d3zd3z d3zd3z requested a review from teburd April 1, 2025 15:43
[toolchain]
channel = "1.85"
components = [ "rust-src", "rustfmt", "llvm-tools" ]
targets = [
Copy link

@teburd teburd Apr 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be great to see some additional architectures being tested for here...

x86, xtensa (esp32), and sparc (leon) are all supported by upstream rust and by zephyr
https://doc.rust-lang.org/rustc/platform-support/xtensa.html

Not a blocker, but something I'd love to see

@d3zd3z
Copy link
Collaborator Author

d3zd3z commented Apr 4, 2025

So, we need to hold off on this, and perhaps put some thought into this. The CI image has the rust toolchain installed as root, and if cargo thinks it needs to download tools, it will just fail with permission errors.

Perhaps a better solution will be to just specify a minimum rust version in the Cargo files. It will still fail when CI's tools are out of date, but in a more obvious way. This will also keep people happy that don't want to see zephyr's CI doing things like downloading toolchains.

@d3zd3z
Copy link
Collaborator Author

d3zd3z commented Apr 9, 2025

Maybe this will return later. Currently, if the version requested isn't the same as the one in the Zephyr CI, cargo just fails trying to upgrade the tools.

@d3zd3z d3zd3z closed this Apr 9, 2025
@d3zd3z d3zd3z changed the title Add rust-toolchain file Specify minimum rust version Apr 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants