From 05b4749ae742f6b75171f04f6f1c0fadff543db7 Mon Sep 17 00:00:00 2001 From: chrysn Date: Thu, 3 Nov 2022 18:05:26 +0100 Subject: [PATCH 1/2] rust: Run all examples on stable This is possible starting with Rust 1.65. --- examples/rust-gcoap/Makefile | 3 +-- examples/rust-hello-world/Makefile | 8 ++++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/examples/rust-gcoap/Makefile b/examples/rust-gcoap/Makefile index 6e067775a5..bc912e5d3f 100644 --- a/examples/rust-gcoap/Makefile +++ b/examples/rust-gcoap/Makefile @@ -41,8 +41,7 @@ BASELIBS += $(APPLICATION_RUST_MODULE).module FEATURES_REQUIRED += rust_target -# This example requires a nightly version because of the CoAP dependencies -CARGO_CHANNEL ?= ${CARGO_CHANNEL_NIGHTLY} +CARGO_CHANNEL ?= stable # Currently unknown, something related to the LED_PORT definition that doesn't # pass C2Rust's transpilation diff --git a/examples/rust-hello-world/Makefile b/examples/rust-hello-world/Makefile index 9c175e73eb..b0f4f15ccf 100644 --- a/examples/rust-hello-world/Makefile +++ b/examples/rust-hello-world/Makefile @@ -21,10 +21,10 @@ BASELIBS += $(APPLICATION_RUST_MODULE).module FEATURES_REQUIRED += rust_target -# While this example can be built with stable Rust on many platforms, the -# nightly channel is selected to smoothly transition from running this example -# to experimenting with it (which might easily lead into nightly territory). -CARGO_CHANNEL ?= $(CARGO_CHANNEL_NIGHTLY) +# All Rust components RIOT uses work on stable Rust. If any extra libraries +# were to require a more recent version, switch to `CARGO_CHANNEL = +# $(CARGO_CHANNEL_NIGHTLY)` to use whichever nightly version is available. +CARGO_CHANNEL ?= stable # Currently unknown, something related to the LED_PORT definition that doesn't # pass C2Rust's transpilation From 75836268e60c593e5e2e50d40b08e448701baa7f Mon Sep 17 00:00:00 2001 From: chrysn Date: Thu, 3 Nov 2022 18:08:32 +0100 Subject: [PATCH 2/2] doc/rust: Nightly is not needed any more --- doc/doxygen/src/using-rust.md | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/doc/doxygen/src/using-rust.md b/doc/doxygen/src/using-rust.md index 55ad2f27cc..ca3e11e204 100644 --- a/doc/doxygen/src/using-rust.md +++ b/doc/doxygen/src/using-rust.md @@ -106,26 +106,21 @@ Toolchain {#toolchain} To install the necessary Rust components, it is easiest use [**rustup**, installed as described on its website]. -Using Rust on RIOT needs the latest stable or nightly version of Rust, -depending on the precise example used. -(Currently, it's mainly the CoAP parts that use nightly features, and some native builds; -until stable is universally available, only tests are run on stable by default). +Using Rust on RIOT needs the latest stable version of Rust. -Make sure you have both the nightly and stable **toolchains** +Make sure you have the stable **toolchain** and the core library for the CPU (**target**) of your choice available: ``` -$ rustup toolchain add nightly $ rustup toolchain add stable -$ rustup target add thumbv7m-none-eabi --toolchain nightly $ rustup target add thumbv7m-none-eabi --toolchain stable ``` Substitute thumbv7m-none-eabi with the value of `RUST_TARGET` -in the output of `make info-build` of an application that has your current board selected, -or just add it later whenever the Rust compiler complains about not finding the core library for a given target). -Installing only nightly will work just as well, -but you may need to remove the `CARGO_CHANNEL = stable` line to run tests. +in the output of `make info-build` of an application that has your current board selected +(or just add it later whenever the Rust compiler complains about not finding the core library for a given target). +Using a beta or nightly will work just as well, +but you may need to set `CARGO_CHANNEL=nightly` on your shell or in your Makefiles. While Rust comes with its own [cargo] dependency tracker for any Rust code,