Skip to content
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

rust: Don't be so picky about toolchains #18840

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 12 additions & 15 deletions doc/doxygen/src/using-rust.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,26 +106,23 @@ 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).

Make sure you have both the nightly and stable **toolchains**
and the core library for the CPU (**target**) of your choice available:
While the compiler installed through rustup can generate code for all supported platforms,
you will still need to download the core libraries for your **target**:

```
$ rustup toolchain add nightly
$ rustup toolchain add stable
$ rustup target add thumbv7m-none-eabi --toolchain nightly
$ rustup target add thumbv7m-none-eabi --toolchain stable
$ rustup target add thumbv7m-none-eabi
```

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).

If you prefer to use other **targets** than the default "stable"
(popular choices are "beta", "nightly" or a particular nightly such as "nightly-2022-10-14"),
you'll need to make sure that the core library is available for that target
by running the `target add` line with a parameter of `--toolchain nightly` or similar.
Note that some tests force the toolchain to "stable",
so you'll need to either have that available or override the `CARGO_CHANNEL` make variable.


While Rust comes with its own [cargo] dependency tracker for any Rust code,
Expand Down
3 changes: 0 additions & 3 deletions examples/rust-gcoap/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@ 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}

# Currently unknown, something related to the LED_PORT definition that doesn't
# pass C2Rust's transpilation
BOARD_BLACKLIST := ek-lm4f120xl
Expand Down
5 changes: 0 additions & 5 deletions examples/rust-hello-world/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,6 @@ 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)

# Currently unknown, something related to the LED_PORT definition that doesn't
# pass C2Rust's transpilation
BOARD_BLACKLIST := ek-lm4f120xl
Expand Down