Skip to content

Commit

Permalink
Merge #19058
Browse files Browse the repository at this point in the history
19058: rust: Use stable Rust [backport 2022.10] r=miri64 a=maribu

# Backport of #18839

### Contribution description

Since Rust 1.65, we don't depend on anything nightly any more. This changes the examples and documentation to use stable.

### Testing procedure

* Green CI with tests enabled
* Look at changed documentation ([rendered](https://ci.riot-os.org/results/2923b30a4ba04dbface1ed38fb6aae12/doc-preview/using-rust.html#toolchain))

<del>Note that these will *not* pass yet: This needs a CI update (no PR associated: Any CI image built from now on will do).</del>

### Issues/PRs references

A follow-up will simplify things a bit further, but that will depend on CI to have made stable the default, which is a later step in what is a bit of a lock-step game:

* [x] CI rebuilds riotdocker -- no PR, then stable=1.65
* [ ] Use stable in examples -- this PR, then examples use stable
* [ ] CI removes nightly and makes stable the default -- RIOT-OS/riotdocker#214, then default=stable
* [ ] Use the new default to simplify makefiles -- #18840

Co-authored-by: chrysn <chrysn@fsfe.org>
  • Loading branch information
bors[bot] and chrysn authored Jan 12, 2023
2 parents 7ebbdc7 + ece93b8 commit db2a3eb
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 17 deletions.
17 changes: 6 additions & 11 deletions doc/doxygen/src/using-rust.md
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 1 addition & 2 deletions examples/rust-gcoap/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions examples/rust-hello-world/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit db2a3eb

Please sign in to comment.